Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel run all queues at once

If i have multiple queues , is it possible to run all of them in sequence without needing to name each one on --queue option?

like image 576
alex Avatar asked Jun 07 '16 06:06

alex


2 Answers

You could use php artisan queue:work --queue=queue1,queue2,queue3 to run multiple ones, but it will be a single process and the priority on which queue's jobs are executed first is the order of how you list the queues in the command. (So in this example, first all queue1 jobs, then all queue2 jobs, etc.)

Running the following example will create numerous parallel processes which independently monitor queues without any queue prioritization:

php artisan queue:work --queue=queue1 & php artisan queue:work --queue=queue2 & php artisan queue:work --queue=queue3 &

I think listening for all possible queues is not supported, because the reason for defining seperate queues is seperate processing. (E.g. do Email Jobs on a different machine)

like image 129
Bart Verhaegh Avatar answered Oct 20 '22 01:10

Bart Verhaegh


This solved my problem, I don't know whether it will help you or not.

php artisan queue:work --queue=low,high,

There are 3 queues in Laravel by default; "low, high," The third one is empty; it's not that hard or bad to just add these 3 queues in your queries.

If you've installed a process monitor like supervisor, you can simply add another background process for your default queues. Don't forget numprocs, you can raise it more than high and low queue because default queues may be more important.

like image 38
X 47 48 - IR Avatar answered Oct 20 '22 01:10

X 47 48 - IR