Hey,
That's an old question but I'm gonna answer anyway as I was wondering the same thing and couldn't find the answer anywhere.
I've seen everywhere people declaring multiple otherwise identical connections to achieve running multiple queues, like so:
'connections' => [
'redis_high' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'high',
'retry_after' => 90,
'block_for' => null,
],
'redis_default' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
],
]
This feels odd as Laravel's documentation insists itself on the fact that a same connection can run multiple queues.
So I went on testing for myself and I found out that you actually don't need to specify each queue if you want to use the same connection. Say you declared this connection:
'connections' => [
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => 'default',
'retry_after' => 90,
'block_for' => null,
],
]
And that Redis is your default driver. If you push a job without specifying a queue, it will be pushed on the default one:
Queue::push($job);
If you specify a queue however, it will be pushed onto it even if it does not appear in the queue.php config file:
Queue::pushOn('high', $job);
As long as you specify that queue in the Supervisor config, its jobs will be processed:
command=php /var/www/site/artisan queue:work redis --queue=high,default
So it looks like it's optional to have them in the config file as long as a default connection is set up. I guess the only interest to list them all in queue.php is to keep track of them, or if indeed you need specific settings for a particular queue (i.e. you need to declare a separate connection).