- Background sending
- Pub/Sub
- Non-blocking
- Module for Rock Framework
From the Command Line:
composer require romeoz/rock-mq:*@dev
In your composer.json:
{
"require": {
"romeoz/rock-mq": "*@dev"
}
}
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"
- PHP 5.4+
- Gearman should be installed
apt-get install libgearman7
. Also, should be installed PHP extensionapt-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 extensionapt-get install php-zmq
Note: if you have problems with the installation, then see config .travis.
A message queue API is open-sourced software licensed under the MIT license.