plumber / plumber
A library for consumer queuse data use workerman
dev-master
2023-02-03 08:49 UTC
Requires
- php: >= 5.5
- aws/aws-sdk-php: ^3.209
- php-amqplib/php-amqplib: ^3.4
- workerman/workerman: ^4.1
This package is auto-updated.
Last update: 2024-03-30 00:38:02 UTC
README
使用workerman消费队列数据
Installation
You can add this library as a local, per-project dependency to your project using Composer:
composer require plumber/plumber
Use
$queuename = "queuename"; $callback = "test::test"; //消费sqs数据会会交由该方法处理 $config = []; //配置信息 $plumber = new plumber($queuename, $callback, $config); $plumber->run();
config配置信息说明
provider
- 队列产品, 如SQS, RabbitMQcount
- workerman所起的进程数量rabbitmq
- rabbitmq credentials 集合host
- 链接地址port
- 端口login
- 用户名password
- 密码vhost
- vhost地址默认为"/
"
key
- aws account idsecret
- aws account secretregion
- region
callback函数返回数据格式
["msg" => "success"]
注意: 只要当msg为successs
时, 程序才会从队列中移除已经处理的消息
run
Usage: php yourfile <command> [mode] Commands: start Start worker in DEBUG mode. Use mode -d to start in DAEMON mode. stop Stop worker. Use mode -g to stop gracefully. restart Restart workers. Use mode -d to start in DAEMON mode. Use mode -g to stop gracefully. reload Reload codes. Use mode -g to reload gracefully. status Get worker status. Use mode -d to show live status. connections Get worker connections.