layout | parent | title | nav_order |
---|---|---|---|
default |
Laravel |
Queues |
2 |
{% include support.md %}
The LaravelQueue package allows to use queue-interop compatible transports the Laravel way. I suppose you already installed and configured the package so let's look what you have to do to make queue work.
You have to add a connector to config/queues.php
file. The driver must be interop
.
<?php
// config/queue.php
return [
'default' => 'interop',
'connections' => [
'interop' => [
'driver' => 'interop',
'dsn' => 'amqp+rabbitmq://guest:guest@localhost:5672/%2f',
],
],
];
Here's a full list of supported transports.
Same as standard Laravel Queues
Send message example:
<?php
$job = (new \App\Jobs\EnqueueTest())->onConnection('interop');
dispatch($job);
Consume messages:
$ php artisan queue:work interop
<?php
// config/queue.php
return [
// uncomment to set it as default
// 'default' => env('QUEUE_DRIVER', 'interop'),
'connections' => [
'interop' => [
'driver' => 'interop',
// connects to localhost
'dsn' => 'amqp:', //
// could be "rabbitmq_dlx", "rabbitmq_delay_plugin", instance of DelayStrategy interface or null
// 'delay_strategy' => 'rabbitmq_dlx'
],
],
];