t4web / queue
ZF2 Module. Message broker software implementation
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/t4web/queue
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: 2025-10-26 19:59:48 UTC
README
ZF2 Module. Message broker software implementation
Introduction
Contain parts:
- Server- get messages from queue and run workers, monitor running workers count
- Producer- produces messages and sends them to the queue
- Worker- you background job
- Storage- messages storage
Workflow
- Client tell Producerwhat it want to process
- Producercreate message and put it in- Storageand get Message Id. After this push Server to process message by Id
- Servercheck Workers count (if too much workers are running, wait) and run- Workerwith Message Id.
- Worker- get message from storage and process it.
                               Server
                    message  /        \  run worker
Client -> Producer --------->          -------------> Worker
                             \                          /
                               Storage             --->-
In the box we provide 2 Servers:
- Realtime server - uses ReactPHP to run a non-blocking server that accepts messages via a socket and executes them in a background process.
- Interval server - check storage for Messages by interval (run by cronjob)
Configuring
Just add in you config:
'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, ], ], ];
Runing
$ php public/index.php queue realtime-server