Sha256: b041ad90253c0ee9e4bf170650710f5b8cd55420cecd74a31df5fcf6b5fafbd7

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

module RosettaQueue
  class Consumer < Base

    def self.receive(destination, options = {})
      RosettaQueue::Adapter.instance.receive_once(Destinations.lookup(destination), options)
      
      rescue Exception=>e
        RosettaQueue.logger.error("Caught exception in Consumer#receive: #{$!}\n" + e.backtrace.join("\n\t"))
    end

    def self.delete(destination, options={})
      RosettaQueue::Adapter.instance.delete(Destinations.lookup(destination), options)
      
      rescue Exception=>e
        RosettaQueue.logger.error("Caught exception in Consumer#delete: #{$!}\n" + e.backtrace.join("\n\t"))
    end 

    def initialize(message_handler)
      @message_handler = message_handler
    end

    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

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cwyckoff-rosetta_queue-0.2.0 lib/rosetta_queue/consumer.rb
cwyckoff-rosetta_queue-0.2.1 lib/rosetta_queue/consumer.rb