Small library for using Redis as a job queue
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin Change file_exists to is_file in redis-consumer Jan 12, 2016
src Initial commit Jan 8, 2016
tests Initial commit Jan 8, 2016
.gitignore Initial commit Jan 8, 2016
.pullapprove.yml Add Pullapprove configuration Jan 8, 2016
LICENSE Initial commit Jan 8, 2016 Add badges to README Feb 27, 2016
composer.json Initial commit Jan 8, 2016
composer.lock Initial commit Jan 8, 2016
phpunit.xml.dist Initial commit Jan 8, 2016

Equip Redis Queue

Latest Stable Version License Build Status Code Coverage Scrutinizer Code Quality

A small library for using Redis as a job queue in Equip applications.


Use Composer.

composer require equip/redis-queue

Add the DefaultConfigurationSet configuration to your project.


Consumers are written as commands using equip/command. See its documentation for more information.

To run consumers, use a runner like the example included in this repository. This runner uses two environmental variables, REDIS_HOST and REDIS_PORT, to point to the Redis server to use; they default to '' and 6379, respectively. The runner takes a single required parameter: the Redis key representing the queue from which the consumer is to retrieve jobs. REDIS_PORT=12345 ./bin/consume queue_name

Note that your runner will need to configure your Auryn Injector instance appropriately for it to be able to create instances of your consumer command classes and their dependencies.


Jobs are published using an instance of the Publisher class. Configuration included in DefaultConfigurationSet should be sufficient to have Auryn generate an instance of it.

Here's an example of publishing a job from a domain class, where Acme\Command\FooCommand is a command class intended to function as a consumer.

namespace Acme;

use Acme\Command\FooCommand;
use Equip\Adr\DomainInterface;
use Equip\RedisQueue\Publisher;

class FooDomain implements DomainInterface
	private $publisher;

    public function __construct(Publisher $publisher)
        $this->publisher = $publisher;

    public function __invoke(array $input)
        // ...

        $command_options = ['foo' => 'bar'];

To publish a job, the publish() method of the Publisher instance is invoked with these arguments:

  • The first argument is a string containing the name of the queue, which must be a valid Redis key
  • The second argument is a string containing the fully-qualified name of a command class containing the logic for the job to execute
  • The third argument is an associative array of options to be used by an instance of the command class