lib/rabbit/receiving/handler_resolver.rb in rabbit_messaging-0.13.0 vs lib/rabbit/receiving/handler_resolver.rb in rabbit_messaging-0.15.0
- old
+ new
@@ -19,11 +19,16 @@
end
private
def unmemoized_handler_for(group_id, event)
- name = "rabbit/handler/#{group_id}/#{event}".camelize
- handler = name.safe_constantize
+ handler = if Rabbit.config.handler_resolver_callable.is_a?(Proc)
+ Rabbit.config.handler_resolver_callable.call(group_id, event)
+ else
+ name = "rabbit/handler/#{group_id}/#{event}".camelize
+ name.safe_constantize
+ end
+
if handler && handler < Rabbit::EventHandler
handler
else
raise UnsupportedEvent, "#{event.inspect} event from #{group_id.inspect} group is not " \
"supported, it requires a #{name.inspect} class inheriting from " \