Download the PHP package codercms/laravel-queue-rabbitmq without Composer
On this page you can find all versions of the php package codercms/laravel-queue-rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codercms/laravel-queue-rabbitmq
More information about codercms/laravel-queue-rabbitmq
Files in codercms/laravel-queue-rabbitmq
Package laravel-queue-rabbitmq
Short Description RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
License MIT
Informations about the package laravel-queue-rabbitmq
RabbitMQ Queue driver for Laravel
Support Policy
Only the latest version will get new features. Bug fixes will be provided using the following scheme:
Package Version | Laravel Version | Bug Fixes Until | |
---|---|---|---|
6.0 | 5.5 | August 30th, 2019 | Documentation |
7.0 | 5.6 | August 7th, 2018 | Documentation |
7.1 | 5.7 | March 4th, 2019 | Documentation |
7.2 | 5.8 | August 26th, 2019 | Documentation |
8.0 | 5.8 | August 26th, 2019 | Documentation |
9 | 6 | September 3rd, 2021 | Documentation |
10 | 6, 7 | September 3rd, 2021 | Documentation |
Installation
You can install this package via composer using this command:
The package will automatically register itself.
Add connection to config/queue.php
:
Optional Config
Optionally add queue options to the config of a connection. Every queue created for this connection, get's the properties.
When you want to prioritize messages when they were delayed, then this is possible by adding extra options.
- When max-priority is omitted, the max priority is set with 2 when used.
When you want to publish messages against an exchange with routing-key's, then this is possible by adding extra options.
- When the exchange is omitted, RabbitMQ will use the
amq.direct
exchange for the routing-key - When routing-key is omitted the routing-key by default is the
queue
name. - When using
%s
in the routing-key the queue_name will be substituted.
Note: when using exchange with routing-key, u probably create your queues with bindings yourself.
In Laravel failed jobs are stored into the database. But maybe you want to instruct some other process to also do something with the message. When you want to instruct RabbitMQ to reroute failed messages to a exchange or a specific queue, then this is possible by adding extra options.
- When the exchange is omitted, RabbitMQ will use the
amq.direct
exchange for the routing-key - When routing-key is omitted, the routing-key by default the
queue
name is substituted with'.failed'
. - When using
%s
in the routing-key the queue_name will be substituted.
Note: When using failed_job exchange with routing-key, u probably need to create your exchange/queue with bindings yourself.
Laravel Usage
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
Laravel Horizon Usage
Starting with 8.0, this package supports Laravel Horizon out of the box. Firstly, install Horizon and then set RABBITMQ_WORKER
to horizon
.
Lumen Usage
For Lumen usage the service provider should be registered manually as follow in bootstrap/app.php
:
Consuming Messages
There are two ways of consuming messages.
-
queue:work
command which is Laravel's built-in command. This command utilizesbasic_get
. rabbitmq:consume
command which is provided by this package. This command utilizesbasic_consume
and is more performant thanbasic_get
by ~2x.
Testing
Setup RabbitMQ using docker-compose
:
To run the test suite you can use the following commands:
If you receive any errors from the style tests, you can automatically fix most, if not all of the issues with the following command:
Contribution
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue. (e.g. [5.2] Fatal error on delayed job)
All versions of laravel-queue-rabbitmq with dependencies
ext-json Version *
illuminate/queue Version ^6.0|^7.0
php-amqplib/php-amqplib Version ^2.11