mix-plus / queue
queue
0.3.7
2022-10-14 01:56 UTC
Requires
- php: >=7.2.0
- mix-plus/event: ^0.1
- mix-plus/utils: ^0.1
- mix/redis: ^3.0
- monolog/monolog: ^2.3
- psr/log: ^1.1
Requires (Dev)
- swoole/ide-helper: ^5.0
README
Generic resident memory queue Swoole support
install
composer require mix-plus/queue
run
// create queue $queue = new RedisDriver([ 'default' => 'default', 'host' => '127.0.0.1', 'port' => 6379, 'password' => '', 'select' => 0, 'timeout' => 0, ], [ QueueHandleListener::class, QueueLengthListener::class, ReloadChannelListener::class, ]); // start consume // Swoole is coroutine run go $queue->consume(); $queue->consume();
test
php test/queue.php
array(10) {
[0]=>
bool(false)
[1]=>
bool(false)
[2]=>
bool(false)
[3]=>
bool(false)
[4]=>
bool(false)
[5]=>
bool(false)
[6]=>
bool(false)
[7]=>
bool(false)
[8]=>
bool(false)
[9]=>
bool(true)
}
string(9) "123123123"
string(8) "dispatch"
string(8) "dispatch"
string(8) "dispatch"
string(8) "dispatch"
LICENSE
Apache License Version 2.0, http://www.apache.org/licenses/