Reputation: 7895
If i have multiple queues , is it possible to run all of them in sequence without needing to name each one on --queue
option?
Upvotes: 9
Views: 13719
Reputation: 1478
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.
Upvotes: 1
Reputation: 76
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)
Upvotes: 4
Reputation: 836
you could use Symfony's Process to run the command through PHP.
$process = new Process('php artisan queue:work --queue=your_queue');
$process->run(); // Sync
$process->start(); // Async
If you will use specific queue names those can be added to the listener as specified in the documentation.
php artisan queue:listen --queue=queue1,queue2
Upvotes: -3