装备 / 队列
该软件包已被放弃,不再维护。未建议替代软件包。
更好的队列库
0.11.0
2017-01-10 16:50 UTC
Requires
- php: >=5.6
- league/event: ^2.1
- league/tactician: ^1.0
- psr/log: ^1.0
Requires (Dev)
- eloquent/liberator: ^2.0
- eloquent/phony: 0.13.4
- monolog/monolog: ^1.21
- pda/pheanstalk: ^3.1
- phpunit/phpunit: ^5.4
Suggests
- monolog/monolog: For a simple logging implementation of PSR-3
README
详细信息
可用驱动器
- Redis
缺少您想要的驱动器? 创建它!
创建消费者
// 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);
以下是一个 示例消费者
创建生产者
// 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);
以下是一个 示例生产者
向队列添加消息
$result = $queue->add($queue, Command::class, new Options);
返回一个布尔值($result
),其中包含将消息推送到队列的状态。
创建驱动器
创建驱动器就像实现DriverInterface一样简单。