Support the ongoing development of Laravel.io →
Configuration Queues Architecture
Last updated 1 year ago.
0

After digging a little bit in the source code if figured out how to do it. In the QueueInterface there is the specification of the interface : /** * Push a new job onto the queue. * * @param string $job * @param mixed $data * @param string $queue * @return mixed */ public function push($job, $data = '', $queue = null);

So by the third parameter- which is not mentioned in the documentation - we could push to a specific queue.

and in the queue' configuration file we should add multiple declaration for the specific queue

for example redis

'redis' => array( 'driver' => 'redis', 'queue' => 'high', ),

'redis' => array( 'driver' => 'redis', 'queue' => 'low', ),

'redis' => array( 'driver' => 'redis', 'queue' => 'ultimate', ),

this 'low,high,ultimate' is what we specify in the third parameter of the push function.

finally we lunch the command : php artisan queue:listen --queue=low,hight,ultimate

so it will pick the jobs by their priority

hope it will help someone in the future.

Last updated 1 year ago.
0

mouradghafiri it just helped me! I came here to search on queue prioritisation, because I want to be able to prioritize creating PDF invoices before sending newsletter, so your post just helped me a lot! Thank you!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.