Sha256: 05aea7bf37b1a9d98ed4ceb0318c8a14f7245794c41663f2e95b41c50e3588cb
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true require 'bbk/app/dispatcher/message' module BBK module AMQP # Store information about consumed AMQP message class Message < BBK::App::Dispatcher::Message attr_reader :properties def initialize(consumer, delivery_info, properties, body) @properties = properties.to_h.with_indifferent_access headers = @properties.except(:headers).merge(@properties[:headers].presence || {}).with_indifferent_access amqp_consumer = delivery_info[:consumer] delivery_info = delivery_info.to_h.merge( message_consumer: consumer, protocols: consumer.protocols, queue: amqp_consumer&.queue_name ) super(consumer, delivery_info, headers, body) end def message_id headers[:message_id] end def reply_to headers[:reply_to] || user_id end def user_id headers[:user_id] end def clone self.class.new(consumer, delivery_info, properties, body) end def protocol consumer&.protocols&.first end def inspect # :nodoc: "#<#{self.class.name} @consumer=#{consumer.class.name}, @delivery_info=#{delivery_info.except(:message_consumer).inspect}, @headers=#{headers.inspect}, @properties=#{@properties.inspect}>" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bbk-amqp-1.1.1.273631 | lib/bbk/amqp/message.rb |