Class: RosettaQueue::Gateway::DirectExchange

Inherits:
BaseExchange show all
Defined in:
lib/rosetta_queue/adapters/amqp.rb

Instance Method Summary collapse

Methods inherited from BaseExchange

#initialize, #publish_to_exchange

Constructor Details

This class inherits a constructor from RosettaQueue::Gateway::BaseExchange

Instance Method Details

#do_exchange(destination, message_handler) ⇒ Object



93
94
95
96
97
98
# File 'lib/rosetta_queue/adapters/amqp.rb', line 93

def do_exchange(destination, message_handler)
  channel.queue(destination).subscribe do |msg|
    RosettaQueue.logger.info("Receiving from #{destination} :: #{msg}")
    message_handler.on_message(Filters.process_receiving(msg))
  end
end

#do_single_exchange(destination, opts = {}) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/rosetta_queue/adapters/amqp.rb', line 100

def do_single_exchange(destination, opts={})
  EM.run do
    channel.queue(destination).pop do |msg|
      RosettaQueue.logger.info("Receiving from #{destination} :: #{msg}")
      yield Filters.process_receiving(msg)
    end
  end
end