Download the PHP package kontoulis/rabbitmq-laravel without Composer
On this page you can find all versions of the php package kontoulis/rabbitmq-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kontoulis/rabbitmq-laravel
More information about kontoulis/rabbitmq-laravel
Files in kontoulis/rabbitmq-laravel
Package rabbitmq-laravel
Short Description RabbitMQ Broker for Laravel
License MIT
Homepage https://github.com/kontoulis/RabbitMQLaravel
Informations about the package rabbitmq-laravel
RabbitMQLaravel
Installation
Via Composer
Add the Service Provider to config/app.php
Add the RabbitMQ facade to config/app.php
Publish the configuration file and edit it if needed in config/rabbitmq-laravel.php
Usage
- Routing Key / Queue Name
The default routing key can be set in config file, or env("APP_NAME")."_queue") will be used.
Also most methods take argument $routingKey
which can override the default.
- Exchange
If you don't set an exchange the default ''
exchange will be used.
If you set one, make sure the bindings are set in RabbitMQ system.
if you are not familiar with exchanges you will probably do not need to set that.
You can use the RabbitMQ facade to do anything as seen in https://github.com/php-amqplib/php-amqplib/blob/master/PhpAmqpLib/Channel/AMQPChannel.php . Basically, the RabbitMQ facade uses the Broker class which is an extension of AMQPChannel.
-
Publishing
- Consuming the Queue
In order to consume the queue, you could either use the AmqpChannel through the Facade, or use a better to manage approach with QueueHandlers. A QueueHandler should extend the Kontoulis\RabbitMQLaravel\Handlers\Handler class and the built-in ListenToQueue method accepts an array of handlers to process the queue message. If more than one handler exists in array, there are some Handler return values that will use the follow up QueueHandlers in cases of failure of the previous. There is also a Kontoulis\RabbitMQLaravel\Handlers\Handler\DefaultHandler class as example and/or debug handler.
In order to Listen to the Queue you have to pass an array of Handlers to the method
License
The MIT License (MIT). Please see LICENCE.md for more information.