Module: Mafia::Consumer::ClassMethods
- Defined in:
- lib/mafia/consumer.rb
Instance Attribute Summary collapse
-
#routing_key ⇒ Object
readonly
Returns the value of attribute routing_key.
Instance Method Summary collapse
- #consume(routing_key) ⇒ Object
- #get_queue_name ⇒ Object
- #process(routing_key, *args) ⇒ Object
-
#queue_name(name) ⇒ Object
Explicitly set the queue name.
Instance Attribute Details
#routing_key ⇒ Object (readonly)
Returns the value of attribute routing_key.
13 14 15 |
# File 'lib/mafia/consumer.rb', line 13 def routing_key @routing_key end |
Instance Method Details
#consume(routing_key) ⇒ Object
15 16 17 |
# File 'lib/mafia/consumer.rb', line 15 def consume(routing_key) @routing_key = routing_key end |
#get_queue_name ⇒ Object
28 29 30 31 32 33 |
# File 'lib/mafia/consumer.rb', line 28 def get_queue_name return @queue_name unless @queue_name.nil? queue_name = self.name.gsub(/::/, ':') queue_name.gsub!(/([^A-Z:])([A-Z])/) { "#{$1}_#{$2}" } queue_name.downcase end |
#process(routing_key, *args) ⇒ Object
19 20 21 |
# File 'lib/mafia/consumer.rb', line 19 def process(routing_key, *args) new(routing_key).process(*args) end |
#queue_name(name) ⇒ Object
Explicitly set the queue name
24 25 26 |
# File 'lib/mafia/consumer.rb', line 24 def queue_name(name) @queue_name = name end |