Download the PHP package equip/redis-queue without Composer
On this page you can find all versions of the php package equip/redis-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download equip/redis-queue
More information about equip/redis-queue
Files in equip/redis-queue
Package redis-queue
Short Description Small library for using Redis as a job queue
License MIT
Informations about the package redis-queue
Equip Redis Queue
A small library for using Redis as a job queue in Equip applications.
Installation
Use Composer.
Add the DefaultConfigurationSet
configuration to your project.
Consuming
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 '127.0.0.1'
and 6379
, respectively. The runner takes a single required parameter: the Redis key representing the queue from which the consumer is to retrieve jobs.
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.
Publishing
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.
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
All versions of redis-queue with dependencies
equip/command Version ^1
equip/framework Version ^1
predis/predis Version ^1