romeoz / rock-mq
Unified API for message queue services
0.10.0
2015-06-12 22:02 UTC
Requires
- php: >=5.4.0
- romeoz/rock-events: 0.10.*
- videlalvaro/php-amqplib: 2.2.*
Requires (Dev)
- phpunit/phpunit: 4.6.*
This package is not auto-updated.
Last update: 2024-11-09 17:14:23 UTC
README
Features
- Background sending
- Pub/Sub
- Non-blocking
- Module for Rock Framework
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 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.
License
A message queue API is open-sourced software licensed under the MIT license.