Class: BBK::AMQP::Message
- Inherits:
-
BBK::App::Dispatcher::Message
- Object
- BBK::App::Dispatcher::Message
- BBK::AMQP::Message
- Defined in:
- lib/bbk/amqp/message.rb
Overview
Store information about consumed AMQP message
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(consumer, delivery_info, properties, body) ⇒ Message
constructor
A new instance of Message.
- #message_id ⇒ Object
- #protocol ⇒ Object
- #reply_to ⇒ Object
- #user_id ⇒ Object
Constructor Details
#initialize(consumer, delivery_info, properties, body) ⇒ Message
Returns a new instance of Message.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bbk/amqp/message.rb', line 11 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 |
Instance Attribute Details
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
9 10 11 |
# File 'lib/bbk/amqp/message.rb', line 9 def properties @properties end |
Instance Method Details
#clone ⇒ Object
37 38 39 |
# File 'lib/bbk/amqp/message.rb', line 37 def clone self.class.new(consumer, delivery_info, properties, body) end |
#message_id ⇒ Object
25 26 27 |
# File 'lib/bbk/amqp/message.rb', line 25 def headers[:message_id] end |
#protocol ⇒ Object
41 42 43 |
# File 'lib/bbk/amqp/message.rb', line 41 def protocol consumer&.protocols&.first end |
#reply_to ⇒ Object
29 30 31 |
# File 'lib/bbk/amqp/message.rb', line 29 def reply_to headers[:reply_to] end |
#user_id ⇒ Object
33 34 35 |
# File 'lib/bbk/amqp/message.rb', line 33 def user_id headers[:user_id] end |