123456789_123456789_123456789_123456789_123456789_

Module: ActiveJob::QueueName::ClassMethods

Relationships & Source Files
Defined in: activejob/lib/active_job/queue_name.rb

Overview

Includes the ability to override the default queue name and prefix.

Class Attribute Summary

Instance Attribute Summary

Instance Method Summary

Class Attribute Details

.default_queue_name (rw) Also known as: #default_queue_name

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_name.rb', line 10

mattr_accessor :default_queue_name, default: "default"

.queue_name_prefix (rw) Also known as: #queue_name_prefix

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_name.rb', line 9

mattr_accessor :queue_name_prefix

Instance Attribute Details

#default_queue_name (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_name.rb', line 10

mattr_accessor :default_queue_name, default: "default"

#queue_name_prefix (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job/queue_name.rb', line 9

mattr_accessor :queue_name_prefix

Instance Method Details

#queue_as(part_name = nil, &block)

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
[ GitHub ]

  
# File 'activejob/lib/active_job/queue_name.rb', line 21

def queue_as(part_name = nil, &block)
  if block_given?
    self.queue_name = block
  else
    self.queue_name = queue_name_from_part(part_name)
  end
end