Package Data | |
---|---|
Maintainer Username: | wajdijurry |
Maintainer Contact: | jurrywajdi@yahoo.com (Wajdi Jurry) |
Package Create Date: | 2021-05-01 |
Package Last Update: | 2023-10-25 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-04-17 03:00:53 |
Package Statistics | |
---|---|
Total Downloads: | 81 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 0 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Its purpose is to initiate workers (consumers) and to send "sync" and "async" requests to another queues or exchanges.
composer require jurry/laravel-rabbitmq
Register this package into your AppServiceProvider:
class AppServiceProvider {
public function register()
{
...
$this->app->singleton(\Jurry\RabbitMQ\Handler\AmqpHandler::class, function () {
return new \Jurry\RabbitMQ\Handler\AmqpHandler(
env('JURRY_RABBITMQ_HOST'), // host
env('JURRY_RABBITMQ_PORT'), // port
env('JURRY_RABBITMQ_USERNAME'), // username
env('JURRY_RABBITMQ_PASSWORD'), // password
'\App\Services', // classesNamespace, where the consumer will look for to process the message with targeted service class
[
'sync_queue' => [ // Sync queue options, will be used when declare the queue
'name' => 'stores_sync',
'message_ttl' => 10000,
],
'async_queue' => [ // Async queue options, will be used when declare the queue
'name' => 'stores_async',
'message_ttl' => 10000,
],
]
);
});
}
}
Register your custom command by adding your created class to the $commands member inside the app/Console/Kernel.php file:
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
// ...
\Jurry\RabbitMQ\Command\SyncConsumerCommand::class,
\Jurry\RabbitMQ\Command\AsyncConsumerCommand::class,
];
// ...
}
Start new workers:
php artisan amqp:sync_worker
php artisan amqp:async_worker