lib/vx/consumer/subscribe.rb in vx-consumer-0.1.2 vs lib/vx/consumer/subscribe.rb in vx-consumer-0.1.3

- old
+ new

@@ -25,10 +25,11 @@ instrumentation = { consumer: params.consumer_name, payload: payload, properties: properties, + channel: channel.id } with_middlewares :sub, instrumentation do instrument("start_processing", instrumentation) instrument("process", instrumentation) do @@ -58,11 +59,11 @@ } session.open ch = session.conn.create_channel - assign_error_handlers_to_channel(ch) + session.assign_error_handlers_to_channel(ch) ch.prefetch configuration.prefetch x = session.declare_exchange ch, params.exchange_name, params.exchange_options q = session.declare_queue ch, params.queue_name, params.queue_options @@ -76,14 +77,9 @@ instrument("bind_queue", instrumentation) do q.bind(x, params.bind_options) end [ch, q] - end - - def assign_error_handlers_to_channel(ch) - ch.on_uncaught_exception {|e, c| Consumer.exception_handler(e, consumer: c) } - ch.on_error {|e, c| Consumer.exception_handler(e, consumer: c) } end end end end