nasustop / hapi-queue
3.0.2
2023-12-30 10:10 UTC
Requires
- php: >=8.0
- hyperf/amqp: ^3.0
- hyperf/async-queue: ^3.0
- hyperf/event: ^3.0
- hyperf/exception-handler: ^3.0
- hyperf/logger: ^3.0
- nasustop/hapi-helpers: ~3.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
Suggests
- swow/swow: Required to create swow components.
This package is auto-updated.
Last update: 2024-10-30 02:16:20 UTC
README
hyperf的队列组件,兼容hyperf/async-queue
和hyperf/amqp
安装
composer require nasustop/hapi-queue
声称配置文件
php bin/hyperf.php vendor:publish nasustop/hapi-queue
调用队列的方式
$job = new DemoJob(['name' => 'hapi']); (new Producer($job))->onQueue('test')->dispatcher();
监听队列
命令行
php bin/hyperf.php hapi:queue:work [queue]
Process进程
# 新建process文件DemoProcess.php # queue配置文件中设置了几个队列,就建立几个process文件,$queue 为配置中的队列名称 <?php namespace App\Demo; use Nasustop\HapiQueue\Consumer; class DemoConsumer extends Consumer { protected string $queue = 'default'; } # 将DemoProcess加入到process配置文件中 # cat config/autoload/processes.php <?php return [ App\Process\Queue\QueueDefaultProcess::class, ];