1
votes

Right now I am using Beanstalkd and Laravel forge for my queues which I fire like this: dispatch(new ProcessPodcast($podcast));

But how do I push a queue into a different job that has a low priority? This will only push the queue into a different job but not set the priority: $job = (new ProcessPodcast($podcast))->onQueue('processing'); dispatch($job);

And if a queue job has a low priority does it mean that it will be fired later when there arent that many queues or how does low priority jobs work?

1
The queue priorities section doesn't answer your question?Wojciech Mleczek
@WojciechMleczek No, does it mean that I must use different queue drivers depening on priority? I only want to use beanstalkuser2722667

1 Answers

2
votes
dispatch((new Job)->onQueue('high'));

This piece of code create new Job class instance, serialize it and store in queue named high, but it not means that this queue is a special one. Moreover this queue could have less priority than the low queue! This is just a string you use to name queue, of course it's highly recommended to follow some patterns to make code more readable for other developers.

In config/queue.php file you can define the default queue name which will be processed. If you create queue worker using php artisan queue:work command then it'll listen job request on that queue. However, you may overwrite default value using --queue parameter in queue:work command:

php artisan queue:work --queue=high,low # or --queue=high,medium,low

This command also set the priority of the queues. As long as there's any job request in the high queue it will be processed before any request in the low queue.