Module: ActiveJob::QueueName::ClassMethods
- Defined in:
- lib/solargraph/rails/annotations/active_job.rb
Overview
Includes the ability to override the default queue name and prefix.
Instance Method Summary collapse
-
#queue_as(part_name = nil, &block) ⇒ void
Specifies the name of the queue to process the job on.
Instance Method Details
#queue_as(part_name = nil, &block) ⇒ void
This method returns an undefined value.
Specifies the name of the queue to process the job on.
class PublishToFeedJob < ActiveJob::Base
queue_as :feeds
def perform(post)
post.to_feed!
end
end
Can be given a block that will evaluate in the context of the job so that a dynamic queue name can be applied:
class PublishToFeedJob < ApplicationJob
queue_as do
post = self.arguments.first
if post.paid?
:paid_feeds
else
:feeds
end
end
def perform(post)
post.to_feed!
end
end
251 |
# File 'lib/solargraph/rails/annotations/active_job.rb', line 251 def queue_as(part_name = nil, &block); end |