lib/vx/lib/consumer/publish.rb in vx-lib-consumer-0.2.2 vs lib/vx/lib/consumer/publish.rb in vx-lib-consumer-0.3.0

- old
+ new

@@ -15,23 +15,21 @@ options[:content_type] ||= params.content_type || configuration.content_type options[:message_id] ||= SecureRandom.uuid name = params.exchange_name - instrumentation = { + env = { payload: payload, exchange: name, consumer: params.consumer_name, properties: options, } - with_middlewares :pub, instrumentation do + with_middlewares :pub, env do session.with_pub_channel do |ch| - instrument(:process_publishing, instrumentation.merge(channel: ch.id)) do - encoded = encode_payload(payload, options[:content_type]) - x = session.declare_exchange ch, name, params.exchange_options - x.publish encoded, options - end + encoded = encode_payload(payload, options[:content_type]) + x = session.declare_exchange ch, name, params.exchange_options + x.publish encoded, options end end end private