lib/freddy/consumers/respond_to_consumer.rb in freddy-jruby-0.4.9 vs lib/freddy/consumers/respond_to_consumer.rb in freddy-jruby-0.5.0

- old
+ new

@@ -1,19 +1,17 @@ class Freddy module Consumers class RespondToConsumer - def initialize(consume_thread_pool, producer, logger) + def initialize(consume_thread_pool, logger) @consume_thread_pool = consume_thread_pool - @producer = producer @logger = logger end - def consume(destination, channel, &block) + def consume(destination, channel, handler_factory, &block) consumer = consume_from_destination(destination, channel) do |delivery| log_receive_event(destination, delivery) - handler_class = MessageHandlers.for_type(delivery.type) - handler = handler_class.new(@producer, destination, @logger) + handler = handler_factory.build(delivery.type, destination) msg_handler = MessageHandler.new(handler, delivery) handler.handle_message delivery.payload, msg_handler, &block end