Class: RosettaQueue::Consumer
- Inherits:
-
Object
- Object
- RosettaQueue::Consumer
- Defined in:
- lib/rosetta_queue/consumer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message_handler) ⇒ Consumer
constructor
A new instance of Consumer.
- #receive ⇒ Object
Constructor Details
#initialize(message_handler) ⇒ Consumer
Returns a new instance of Consumer.
18 19 20 |
# File 'lib/rosetta_queue/consumer.rb', line 18 def initialize() @message_handler = end |
Class Method Details
.delete(destination, options = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/rosetta_queue/consumer.rb', line 11 def self.delete(destination, ={}) RosettaQueue::Adapter.open { |a| a.delete(Destinations.lookup(destination), )} rescue Exception=>e RosettaQueue.logger.error("Caught exception in Consumer.delete: #{$!}\n" + e.backtrace.join("\n\t")) end |
.receive(destination, options = {}) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/rosetta_queue/consumer.rb', line 4 def self.receive(destination, = {}) RosettaQueue::Adapter.open { |a| return a.receive_once(Destinations.lookup(destination), ) } rescue Exception=>e RosettaQueue.logger.error("Caught exception in Consumer.receive: #{$!}\n" + e.backtrace.join("\n\t")) end |
Instance Method Details
#receive ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rosetta_queue/consumer.rb', line 22 def receive connection.receive_with(@message_handler) rescue Exception=>e RosettaQueue.logger.error("Caught exception in Consumer#receive: #{$!}\n" + e.backtrace.join("\n\t")) end |