Class: Freddy::Producers::ReplyProducer
- Inherits:
-
Object
- Object
- Freddy::Producers::ReplyProducer
- Defined in:
- lib/freddy/producers/reply_producer.rb
Constant Summary collapse
- CONTENT_TYPE =
'application/json'
Instance Method Summary collapse
-
#initialize(channel, logger) ⇒ ReplyProducer
constructor
A new instance of ReplyProducer.
- #produce(routing_key, payload, properties) ⇒ Object
Constructor Details
#initialize(channel, logger) ⇒ ReplyProducer
Returns a new instance of ReplyProducer.
8 9 10 11 |
# File 'lib/freddy/producers/reply_producer.rb', line 8 def initialize(channel, logger) @logger = logger @exchange = channel.default_exchange end |
Instance Method Details
#produce(routing_key, payload, properties) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/freddy/producers/reply_producer.rb', line 13 def produce(routing_key, payload, properties) span = Tracing.span_for_produce( @exchange, routing_key, payload, correlation_id: properties[:correlation_id] ) properties = properties.merge( routing_key: routing_key, content_type: CONTENT_TYPE ) Tracing.inject_tracing_information_to_properties!(properties) @exchange.publish Payload.dump(payload), properties ensure # We won't wait for a reply. Just finish the span immediately. span.finish end |