t4web / queue
ZF2 模块。消息代理软件实现
0.1.0
2016-06-22 15:19 UTC
Requires
- php: ^5.5 || ^7.0
- react/socket: ~0.4.2
- symfony/process: ~3.1.0
- t4web/admin: dev-master
- t4web/crud: dev-master
- t4web/domain-module: ~1.2.0
- t4web/infrastructure: ~1.2.0
- zendframework/zend-console: ~2.5.0
- zendframework/zend-db: ~2.5.0
- zendframework/zend-json: ~2.5.0
- zendframework/zend-mvc: ~2.5.0
- zendframework/zend-servicemanager: ~2.5.0
Requires (Dev)
- phpunit/phpunit: ^4.8
- squizlabs/php_codesniffer: ^2.3
This package is auto-updated.
Last update: 2024-08-26 17:28:09 UTC
README
ZF2 模块。消息代理软件实现
简介
包含部分
Server
- 从队列获取消息并运行工作进程,监控运行中的工作进程数量Producer
- 产生消息并将它们发送到队列Worker
- 你的后台任务Storage
- 消息存储
工作流程
- 客户端告诉
Producer
它想处理什么 Producer
创建消息并将其放入Storage
并获取消息 ID。之后,通过 ID 推送服务器处理消息Server
检查工作进程数量(如果运行的工作进程太多,等待)并运行带有消息 ID 的Worker
。Worker
- 从存储中获取消息并处理它。
Server
message / \ run worker
Client -> Producer ---------> -------------> Worker
\ /
Storage --->-
我们提供了 2 个服务器
- 实时服务器 - 使用 ReactPHP 运行一个非阻塞服务器,通过套接字接收消息并在后台进程执行它们。
- 间隔服务器 - 通过间隔检查存储中的消息(由 cronjob 运行)
配置
只需将其添加到你的配置中
't4web-queue' => [ 'realtime-server' => [ 'enabled' => true, 'hostname' => 'localhost', 'port' => 4000, ], 'queues' => [ // Queue name 'test-engine' => [ // Handler class 'handler' => EchoWorker::class, // count workers, optional, default 1 'worker-count' => 1, // You can limit the amount of time a process takes to complete by setting a timeout (in seconds) // optional, default 300 'timeout' => 300, // optional, default 0 'debug-enable' => 1, ], ], ];
运行
$ php public/index.php queue realtime-server