Sha256: 18a5bf966caf43a6c1a856219358713284a8d8f0d71d30e28d9d54ba7ab92ff8

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

class Freddy
  module Producers
    class ReplyProducer
      CONTENT_TYPE = 'application/json'.freeze

      def initialize(channel, logger)
        @logger = logger
        @exchange = channel.default_exchange
      end

      def produce(destination, payload, properties)
        OpenTracing.active_span.log_kv(
          event: 'Sending response',
          queue: destination,
          payload: payload
        )

        properties = properties.merge(
          routing_key: destination,
          content_type: CONTENT_TYPE
        )

        @exchange.publish Payload.dump(payload), properties
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
freddy-1.4.1 lib/freddy/producers/reply_producer.rb
freddy-1.4.0 lib/freddy/producers/reply_producer.rb