Class: Jackhammer::QueueName

Inherits:
Object
  • Object
show all
Defined in:
lib/jackhammer/queue_name.rb

Class Method Summary collapse

Class Method Details

.app_nameObject



3
4
5
# File 'lib/jackhammer/queue_name.rb', line 3

def self.app_name
  Jackhammer.configuration.app_name
end

.from_routing_key(routing_key) ⇒ Object



7
8
9
10
11
# File 'lib/jackhammer/queue_name.rb', line 7

def self.from_routing_key(routing_key)
  fail(InvalidConfigError, "app_name must be set to determine queue_name from routing_key") if app_name.to_s.empty?

  "#{app_name}_#{routing_key}_q".gsub(/[^\w]+/, '_').squeeze('_')
end