1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/lib/active_job/queue_name.rb
Abdelkader Boudih 68c643f8e7 [ActiveJob] Add queue_name_prefix so all queue are prefixed .
We can split queues on a per environement basis as well as seggregate per application so we can split queues on a per env basis

ActiveJob::Base.queue_name_prefix = 'foo'
2014-08-18 20:04:02 +00:00

21 lines
537 B
Ruby

module ActiveJob
module QueueName
extend ActiveSupport::Concern
module ClassMethods
mattr_accessor(:queue_name_prefix)
mattr_accessor(:default_queue_name) { "default" }
def queue_as(part_name)
queue_name = part_name.to_s.presence || default_queue_name
name_parts = [queue_name_prefix.presence, queue_name]
self.queue_name = name_parts.compact.join('_')
end
end
included do
class_attribute :queue_name
self.queue_name = default_queue_name
end
end
end