Download the PHP package vnay92/laravel-custom-queue without Composer
On this page you can find all versions of the php package vnay92/laravel-custom-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vnay92/laravel-custom-queue
More information about vnay92/laravel-custom-queue
Files in vnay92/laravel-custom-queue
Package laravel-custom-queue
Short Description A Queue Handler For Messages that are not Laravel Jobs. Useful while communicating between Laravel and External Systems
License MIT
Informations about the package laravel-custom-queue
Custom Queue Handler For Laravel
Laravel custom Queue Handler is a simple implementation of the laravel-esque queue handling for all queues and messages that are not part of the Laravel Framework.
There are times when your application would want to consume messages as a JSON, sent on a Queue that does not implement the Laravel Job.
This package aims to solve that use case.
Supports the same commands as Laravel, with the same parameters, with one additional Parameter:
-
custom-queue:work --handler="Class\Path\To\Handler"
-
custom-queue:listen --handler="Class\Path\To\Handler"
custom-queue:restart
Currently Supported Queues:
- RabbitMQ
Laravel Version Compatibility
- Laravel
4.x
is not supported. - Laravel
5.x.x
is supported from5.1
in the respective branch.
Installation
Laravel 5.x
Install the vnay92/laravel-custom-queue
package:
You'll need to add the following to your config/app.php
:
Configuration
Create the Custom Queue configuration file (config/custom-queue.php
):
And add these properties to .env
with proper values:
CUSTOM_QUEUE_DRIVER=rabbitmq
RABBITMQ_HOST=127.0.0.1
RABBITMQ_PORT=5672
RABBITMQ_VHOST=/
RABBITMQ_LOGIN=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_QUEUE=queue_name
The above commands and configurations are used as follows:
Example
Create a handler class which implements the Vnay92\Contracts\HandlerInterface
and implement the handle()
method.
Then start listening to the queues as follows:
$ php artisan custom-queue:work --handler="App\Services\ExternalMessagesService\ExternalMessagesService" --queue=custom_queue
Contributing
Dependencies are managed through composer:
TODOs
- Provide many Queues Connector
- Tests using PHPUnit
- DocBlokr for all methods and members
- Provide support for each version of Laravel.