Class: CottonTail::DSL::Queue
- Inherits:
-
Object
- Object
- CottonTail::DSL::Queue
- Defined in:
- lib/cotton_tail/dsl/queue.rb
Overview
Queue DSL
Instance Method Summary collapse
- #bind(key) ⇒ Object
- #handle(key, handler = nil, &block) ⇒ Object
-
#initialize(name, queue, context) ⇒ Queue
constructor
A new instance of Queue.
- #topic(routing_prefix, &block) ⇒ Object
Constructor Details
#initialize(name, queue, context) ⇒ Queue
Returns a new instance of Queue.
7 8 9 10 11 |
# File 'lib/cotton_tail/dsl/queue.rb', line 7 def initialize(name, queue, context) @name = name @queue = queue @context = context end |
Instance Method Details
#bind(key) ⇒ Object
23 24 25 26 27 |
# File 'lib/cotton_tail/dsl/queue.rb', line 23 def bind(key) return unless @queue.respond_to?(:bind) @queue.bind key end |
#handle(key, handler = nil, &block) ⇒ Object
13 14 15 16 |
# File 'lib/cotton_tail/dsl/queue.rb', line 13 def handle(key, handler = nil, &block) bind(key) @context.handle(key, handler, &block) end |
#topic(routing_prefix, &block) ⇒ Object
18 19 20 21 |
# File 'lib/cotton_tail/dsl/queue.rb', line 18 def topic(routing_prefix, &block) topic = Topic.new(routing_prefix, self) topic.instance_eval(&block) end |