romeoz/rock-mq

Unified API for message queue services

0.10.0 2015-06-12 22:02 UTC

This package is not auto-updated.

Last update: 2024-11-09 17:14:23 UTC


README

Latest Stable Version Total Downloads Build Status Coverage Status License

Rock MQ on Packagist

Features

Installation

From the Command Line:

composer require romeoz/rock-mq:*@dev

In your composer.json:

{
    "require": {
        "romeoz/rock-mq": "*@dev"
    }
}

Quick Start

Run broker:

php tests/data/mq/rabbit/simple_server.php &

Code:

use rock\mq\RabbitQueue;

$rabbit = new RabbitQueue();
$rabbit->send('test'); // result: "Hi! I am server: test"

// or background

$rabbit->sendBackground('test');

####Pub/Sub

Run broker:

php tests/data/mq/rabbit/pub_server.php &

Code:

use rock\mq\RabbitQueue;

$rabbit = new RabbitQueue();
$rabbit->blocking = false;
$rabbit->type = 'direct';
$rabbit->exchange = 'direct_test';

$rabbit->subscribe('foo'); // result: "Hi! I am server: foo"

Requirements

  • PHP 5.4+
  • Gearman should be installed apt-get install libgearman7. Also, should be installed PHP extension apt-get install php5-gearman
  • RabbitMQ should be installed apt-get install rabbitmq-server.
  • ZeroMQ should be installed apt-get install libzmq3. Also, should be installed PHP extension apt-get install php-zmq

Note: if you have problems with the installation, then see config .travis.

License

A message queue API is open-sourced software licensed under the MIT license.