Reputation: 6263
Looking at the job below I would assume the job runs on a low_priority
queue.
class GuestsCleanupJob < ActiveJob::Base
queue_as :low_priority
#....
end
I would agree with this, but this is just the name of the queue correct? It actually has nothing to do with priority. For example if I created a job with a queue named :my_queue
it would be treated as having the same priority as a :low_priority
queue.
From the documentation I haven't been able to find anything indicating that I can prioritize jobs that are queued. I know delayed_jobs has this functionality, but I haven't found it in active_job.
Upvotes: 10
Views: 5818
Reputation: 7655
Priority depends on actual QueueAdapter and how this adapter was configured. If your adapter does not support priorities or was not properly configured, then ActiveJob can't help you either.
Find out more details about adapters from here:
http://edgeapi.rubyonrails.org/classes/ActiveJob/QueueAdapters.html
The main takeaway is this:
The main point is to ensure that all Rails apps will have a job infrastructure in place. We can then have framework features and other gems build on top of that, without having to worry about API differences between various job runners such as Delayed Job and Resque. Picking your queuing backend becomes more of an operational concern, then. And you'll be able to switch between them without having to rewrite your jobs.
Queue configuration (including priorities) becomes Adapter's responsibility.
As an example of queue configuration see Sidekiq wiki:
https://github.com/mperham/sidekiq/wiki/Advanced-Options#queues
Upvotes: 6