softonic / laravel-queue-job
Custom Job implementation for vyuldashev@laravel-queue-rabbitmq library
Installs: 8 394
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: ^9.0|^10.0
- vladimir-yuldashev/laravel-queue-rabbitmq: ^13.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^7.00
- phpunit/phpunit: ^9.0
- rector/rector: ^0.12.13
- squizlabs/php_codesniffer: ^3
This package is auto-updated.
Last update: 2024-11-20 16:33:31 UTC
README
Custom Job implementation for vyuldashev/laravel-queue-rabbitmq library
⚠️ This library works on vyuldashev/laravel-queue-rabbitmq. If you have questions about how to configure connections, feel free to read the vyuldashev/laravel-queue-rabbitmq documentation.
Main features
- Add support to have multiple Handlers for the same Routing key.
- Assign your Routing keys with your Handlers in the queue config file.
Installation
You can require the last version of the package using composer
composer require softonic/laravel-queue-job
Usage
Replace your RabbitMQJob class in the queue config file.
'connections' => [
// ...
'rabbitmq' => [
// ...
'options' => [
'queue' => [
// ...
'job' => \Softonic\LaravelQueueJob\RabbitMQJob::class,
],
],
],
// ...
],
Add your message_handlers mapping in queue config file:
'message_handlers' => [
TestHandler::class => [ // Handler
'#.test_v1.created.testevent', // Routing keys
'#.test_v1.replaced.testevent',
'#.test_v1.updated.testevent',
'global.test_v1.updated.testevent',
// ...
],
AnotherTestHandler::class => [
'#.test_v1.created.testevent',
'global.test_v1.updated.testevent',
// ...
],
// ...
],
Testing with artisan
Your
php artisan queue:work {connection-name} --queue={queue-name}
Testing
softonic/laravel-queue-job
has a PHPUnit test suite, and a coding style compliance test suite using PHP CS Fixer.
To run the tests, run the following command from the project folder.
$ make tests
To open a terminal in the dev environment:
$ make debug
License
The Apache 2.0 license. Please see LICENSE for more information.