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'.freeze
Instance Method Summary collapse
-
#initialize(channel, logger) ⇒ ReplyProducer
constructor
A new instance of ReplyProducer.
- #produce(destination, payload, properties) ⇒ Object
Constructor Details
#initialize(channel, logger) ⇒ ReplyProducer
Returns a new instance of ReplyProducer.
6 7 8 9 |
# File 'lib/freddy/producers/reply_producer.rb', line 6 def initialize(channel, logger) @logger = logger @exchange = channel.default_exchange end |
Instance Method Details
#produce(destination, payload, properties) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/freddy/producers/reply_producer.rb', line 11 def produce(destination, payload, properties) Freddy.trace.log event: 'Sending response', queue: destination, payload: payload properties = properties.merge( routing_key: destination, content_type: CONTENT_TYPE ) @exchange.publish Payload.dump(payload), properties end |