Module: RosettaQueue::MessageHandler

Included in:
Producer
Defined in:
lib/rosetta_queue/message_handler.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#adapter_proxyObject

Returns the value of attribute adapter_proxy.



24
25
26
# File 'lib/rosetta_queue/message_handler.rb', line 24

def adapter_proxy
  @adapter_proxy
end

Class Method Details

.included(receiver) ⇒ Object



20
21
22
# File 'lib/rosetta_queue/message_handler.rb', line 20

def self.included(receiver)
  receiver.extend(ClassMethods)
end

Instance Method Details

#ackObject



47
48
49
# File 'lib/rosetta_queue/message_handler.rb', line 47

def ack
  adapter_proxy.ack unless adapter_proxy.nil?
end

#destinationObject



26
27
28
# File 'lib/rosetta_queue/message_handler.rb', line 26

def destination
  self.class.destination
end

#handle_message(unfiltered_message) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rosetta_queue/message_handler.rb', line 34

def handle_message(unfiltered_message)
  ExceptionHandler::handle(:publishing,
    lambda {
      { :message => Filters.safe_process_receiving(unfiltered_message),
        :destination => destination,
        :action => :consuming,
        :options => options_hash
      }
    } ) do
    on_message(Filters.process_receiving(unfiltered_message))
  end
end

#options_hashObject



30
31
32
# File 'lib/rosetta_queue/message_handler.rb', line 30

def options_hash
  self.class.options_hash
end