Sha256: ef148e580efe95a07c08a66c684a7b7f42d02d34abfef55503bdfa9920672a9b

Contents?: true

Size: 934 Bytes

Versions: 5

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

5 entries across 5 versions & 2 rubygems

Version Path
bmabey-rosetta_queue-0.2.0 lib/rosetta_queue/consumer.rb
cwyckoff-rosetta_queue-0.1.4 lib/rosetta_queue/consumer.rb
cwyckoff-rosetta_queue-0.2.2 lib/rosetta_queue/consumer.rb
cwyckoff-rosetta_queue-0.3.0 lib/rosetta_queue/consumer.rb
cwyckoff-rosetta_queue-0.3.3 lib/rosetta_queue/consumer.rb