Class: Freddy::MessageHandlers::StandardMessageHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/freddy/message_handlers.rb

Instance Method Summary collapse

Constructor Details

#initialize(destination, logger) ⇒ StandardMessageHandler

Returns a new instance of StandardMessageHandler.



19
20
21
22
# File 'lib/freddy/message_handlers.rb', line 19

def initialize(destination, logger)
  @destination = destination
  @logger = logger
end

Instance Method Details

#errorObject



35
36
37
# File 'lib/freddy/message_handlers.rb', line 35

def error(*)
  # NOP
end

#handle_message(payload, msg_handler, &block) ⇒ Object



24
25
26
27
28
29
# File 'lib/freddy/message_handlers.rb', line 24

def handle_message(payload, msg_handler, &block)
  block.call payload, msg_handler
rescue Exception => e
  @logger.error "Exception occured while processing message from #{Utils.format_exception(e)}"
  Utils.notify_exception(e, destination: @destination)
end

#successObject



31
32
33
# File 'lib/freddy/message_handlers.rb', line 31

def success(*)
  # NOP
end