Class: Mercury::ReceivedMessage
- Inherits:
-
Object
- Object
- Mercury::ReceivedMessage
- Defined in:
- lib/mercury/received_message.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #ack ⇒ Object
- #headers ⇒ Object
-
#initialize(content, metadata, is_ackable: false) ⇒ ReceivedMessage
constructor
A new instance of ReceivedMessage.
- #nack ⇒ Object
- #reject ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(content, metadata, is_ackable: false) ⇒ ReceivedMessage
Returns a new instance of ReceivedMessage.
5 6 7 8 9 |
# File 'lib/mercury/received_message.rb', line 5 def initialize(content, , is_ackable: false) @content = content = @is_ackable = is_ackable end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
3 4 5 |
# File 'lib/mercury/received_message.rb', line 3 def content @content end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/mercury/received_message.rb', line 3 def end |
Instance Method Details
#ack ⇒ Object
19 20 21 22 |
# File 'lib/mercury/received_message.rb', line 19 def ack @is_ackable or raise 'This message is not ackable' .ack end |
#headers ⇒ Object
15 16 17 |
# File 'lib/mercury/received_message.rb', line 15 def headers .headers || {} end |
#nack ⇒ Object
29 30 31 32 |
# File 'lib/mercury/received_message.rb', line 29 def nack @is_ackable or raise 'This message is not nackable' .reject(requeue: true) end |
#reject ⇒ Object
24 25 26 27 |
# File 'lib/mercury/received_message.rb', line 24 def reject @is_ackable or raise 'This message is not rejectable' .reject(requeue: false) end |
#tag ⇒ Object
11 12 13 |
# File 'lib/mercury/received_message.rb', line 11 def tag .routing_key end |