Download the PHP package assegaiphp/rabbitmq without Composer
On this page you can find all versions of the php package assegaiphp/rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download assegaiphp/rabbitmq
More information about assegaiphp/rabbitmq
Files in assegaiphp/rabbitmq
Package rabbitmq
Short Description RabbitMQ queue integration for AssegaiPHP framework, providing decorators and tools for producing and consuming AMQP-based jobs.
License MIT
Informations about the package rabbitmq
RabbitMQ queue support for AssegaiPHP applications.
Description
This package integrates RabbitMQ with AssegaiPHP through PhpAmqpLib. It serializes queued domain jobs, hydrates them for typed processors, and settles deliveries according to the processor outcome.
Contribution workflow
For commit and pull request conventions in this repo, see:
- docs/commit-and-pr-guidelines.md
Installation
Install the package with Composer:
Compatibility
| RabbitMQ package | AssegaiPHP Common |
|---|---|
>=1.1.2 <2.0 |
^0.10.1 |
1.1.1 |
^0.10.1 |
1.1.0 |
^0.10.0 |
1.0.x |
^0.9.0 |
Upgrade this package and its coordinated first-party dependencies together when moving between AssegaiPHP release lines.
Configuration
Register the driver and its connections in config/queues.php:
Queue references use the driver.connection format, such as rabbitmq.notifications.
Creating or injecting a queue is configuration-only. The driver opens the AMQP connection, declares the queue, and configures its exchange binding on the first broker operation. This allows an HTTP application to boot while RabbitMQ is temporarily unavailable; the operation that needs RabbitMQ receives the connection error and a later operation can retry.
Manual acknowledgement is the safe default. A successful processor call acknowledges the delivery. A decoding or processor failure nacks it and requeues it unless requeue_on_failure is false.
When exchange_name is non-empty, the driver declares that exchange and binds the queue using routing_key. With an empty exchange name, it publishes directly to the queue name.
Producing jobs
Inject a configured queue using #[InjectQueue] and add a domain job:
The driver writes a versioned JSON envelope containing the job class and payload.
Consuming jobs
Define an injectable processor whose method declares the job type it accepts:
Register the processor in its module's provider list so the Console can discover it. The worker validates the envelope class against the processor parameter and hydrates the domain object before invocation. Legacy JSON messages are hydrated when the processor declares a concrete class; a processor typed only as object receives stdClass.
Generate a processor with the Console when you want a starter class:
Running workers
Discover and run queue processors with the Assegai Console:
Process at most one available job and exit with --once:
If multiple processors target the same queue, use --processor to select one. See the AssegaiPHP queue guide for application-level worker guidance.
Testing
Run the package test suite with Composer:
Resources
Support
Assegai is an MIT-licensed open source project. It can grow thanks to sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Andrew Masiye
- Website - https://assegaiphp.com
- Twitter - @assegaiphp
License
Assegai is MIT licensed.
