Module: Rabbit::Receiving::HandlerResolver

Defined in:
lib/rabbit/receiving/handler_resolver.rb

Constant Summary collapse

UnsupportedEvent =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.handler_for(message) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rabbit/receiving/handler_resolver.rb', line 11

def handler_for(message)
  @handler_cache ||= Hash.new do |cache, (group_id, event)|
    handler = unmemoized_handler_for(group_id, event)
    cache[[group_id, event]] = handler if Rabbit.config.environment == :production
    handler
  end

  @handler_cache[[message.group_id, message.event]]
end