Module: Skein::Adapter

Extended by:
Adapter
Included in:
Adapter
Defined in:
lib/skein/adapter.rb

Instance Method Summary collapse

Instance Method Details

#subscribe(queue, block: true, manual_ack: true) ⇒ Object

REFACTOR: This should be converted into a proper subclass of the

various drivers that does the method re-writing at a lower level.


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/skein/adapter.rb', line 7

def subscribe(queue, block: true, manual_ack: true)
  case (queue.class.to_s.split(/::/)[0])
  when 'Bunny'
    queue.subscribe(block: block, manual_ack: manual_ack) do |delivery_info, properties, payload|
      yield(payload, delivery_info[:delivery_tag], properties[:reply_to])
    end
  when 'MarchHare'
    queue.subscribe(block: block, manual_ack: manual_ack) do |, payload|
      yield(payload, .delivery_tag, .reply_to)
    end
  end
end