Sha256: ae04b9deb860c15a72956ca7074cd3faef3f7a114204de102dd75ab20950c16a

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module Basquiat
  module Adapters
    class RabbitMq
      class Message < Basquiat::Adapters::BaseMessage
        attr_reader :delivery_info, :props
        alias_method :di, :delivery_info
        # @!attribute [r] delivery_info
        #   @return [Hash] RabbitMQ delivery_info.
        # @!attribute [r] props
        #   @return [Hash] RabbitMQ message properties, such as headers.

        def initialize(message, delivery_info = {}, props = {})
          super(message)
          @delivery_info = delivery_info
          @props         = props
          @action        = :ack
        end

        # @!attribute [rw] routing_key
        #   It overrides (but not overwrites) the delivery_info routing_key
        #   @return [String] returns either the set routing_key or the delivery_info routing_key
        attr_writer :routing_key
        def routing_key
          @routing_key || delivery_info.routing_key
        end

        # Shorthand for delivery_info.delivery_tag
        def delivery_tag
          delivery_info.delivery_tag
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
basquiat-1.3.0.pre.1 lib/basquiat/adapters/rabbitmq/message.rb