Class: Rabbitek::MessageProcessor

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Loggable
Defined in:
lib/rabbitek/server/message_processor.rb

Overview

Single message processor

Instance Method Summary collapse

Methods included from Loggable

#debug, #error, #info, #logger, logger, #warn

Constructor Details

#initialize(starter, delivery_info, properties, payload) ⇒ MessageProcessor

Returns a new instance of MessageProcessor.



12
13
14
15
16
17
# File 'lib/rabbitek/server/message_processor.rb', line 12

def initialize(starter, delivery_info, properties, payload)
  @starter = starter
  @delivery_info = delivery_info
  @properties = properties
  @payload = payload
end

Instance Method Details

#processObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/rabbitek/server/message_processor.rb', line 19

def process
  consumer.set_context

  metrics_add_processed_count

  hook_walker = Utils::HookWalker.new(Rabbitek.config.server_hooks)
  hook_walker.call!(consumer, message) { |*args| run_job(*args) }
rescue StandardError => e
  on_message_errored(e)
end