Module: Cottontail::Consumer::ClassMethods
- Defined in:
- lib/cottontail/consumer.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#consume(route = {}, options = {}, &block) ⇒ Object
Method for consuming messages.
-
#session(options = nil, &block) ⇒ Object
Set the Bunny session.
-
#start(blocking = true) ⇒ Object
Conveniently start the consumer.
Instance Method Details
#consume(route = {}, options = {}, &block) ⇒ Object
Method for consuming messages.
When ‘:any` is provided as parameter, all messages will be routed to this block. This is the default.
145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/cottontail/consumer.rb', line 145 def consume(route = {}, = {}, &block) = if route.is_a?(Hash) route else { route: route } end.merge() get(:consumables).push( Cottontail::Consumer::Entity.new(, &block) ) end |
#session(options = nil, &block) ⇒ Object
Set the Bunny session.
You are required to setup a standard Bunny session as you would when using Bunny directly. This enables you to be configurable to the maximum extend.
102 103 104 |
# File 'lib/cottontail/consumer.rb', line 102 def session( = nil, &block) set :session, [, block] end |
#start(blocking = true) ⇒ Object
Conveniently start the consumer
168 169 170 |
# File 'lib/cottontail/consumer.rb', line 168 def start(blocking = true) new.start(blocking) end |