You can install this package via composer using this command:
composer require vladimir-yuldashev/laravel-queue-rabbitmq
The package will automatically register itself using Laravel auto-discovery.
Setup connection in config/queue.php
'connections' => [
// ...
'rabbitmq' => [
'driver' => 'rabbitmq',
'host' => env('RABBITMQ_HOST', '127.0.0.1'),
'port' => env('RABBITMQ_PORT', 5672),
'vhost' => env('RABBITMQ_VHOST', '/'),
'login' => env('RABBITMQ_LOGIN', 'guest'),
'password' => env('RABBITMQ_PASSWORD', 'guest'),
'queue' => env('RABBITMQ_QUEUE', 'default'),
],
// ...
],For others options, see config/rabbitmq.php
Register the service in bootstrap/app.php
// Register Service Providers
// ...
$app->register(VladimirYuldashev\LaravelQueueRabbitMQ\LaravelQueueRabbitMQServiceProvider::class);
// ...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
The package uses enqueue/amqp-lib transport which is based on php-amqplib.
There is possibility to use any amqp interop compatible transport, for example enqueue/amqp-ext or enqueue/amqp-bunny.
Here's an example on how one can change the transport to enqueue/amqp-bunny.
First, install desired transport package:
composer require enqueue/amqp-bunny:^0.8Change the factory class in config/queue.php:
// ...
'connections' => [
'rabbitmq' => [
'driver' => 'rabbitmq',
'factory_class' => Enqueue\AmqpBunny\AmqpConnectionFactory::class,
],
],You can run the tests with:
vendor/bin/phpunitYou 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)