equip/queue

The better queueing library

0.11.0 2017-01-10 16:50 UTC

README

Latest Stable Version License Build Status Code Coverage Scrutinizer Code Quality

Details

Available Drivers
  • Redis

Missing the driver you want? Create it!

Creating A Consumer

// Instantiate Redis
$redis = new Redis;
$redis->connect('127.0.0.1');

// Instantiate the Redis driver
$driver = new Equip\Queue\Driver\RedisDriver($redis);

// Instantiate the event class (which uses league/event)
$emitter = new League\Event\Emitter;
$event = new Equip\Queue\Event($emitter);

// Instantiate the command factory
$injector = new Auryn\Injector;
$factory = new Equip\Queue\Command\AurynCommandFactory($injector);

// Instantiate the Worker class
$worker = new Equip\Queue\Worker($driver, $event, $factory);

// Kick off the consumer
$worker->consume($queue);

Here's an example consumer

Creating A Producer

// Instantiate Redis
$redis = new Redis;
$redis->connect('127.0.0.1');

// Instantiate the Redis driver
$driver = new Equip\Queue\Driver\RedisDriver($redis);

// Instantiate the Queue class
$queue = new Queue($driver);

Here's an example producer

Adding A Message To The Queue

$result = $queue->add($queue, Command::class, new Options);

A boolean ($result) is returned which contains the status of the push onto the queue.

Creating A Driver

Creating a driver is as simple as implementing the DriverInterface.