Class: Mercury::ReceivedMessage
- Inherits:
-
Object
- Object
- Mercury::ReceivedMessage
- Defined in:
- lib/mercury/received_message.rb
Instance Attribute Summary collapse
-
#action_taken ⇒ Object
readonly
Returns the value of attribute action_taken.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#work_queue_name ⇒ Object
readonly
Returns the value of attribute work_queue_name.
Instance Method Summary collapse
- #ack ⇒ Object
- #headers ⇒ Object
-
#initialize(content, metadata, work_queue_name: nil) ⇒ ReceivedMessage
constructor
A new instance of ReceivedMessage.
- #nack ⇒ Object
- #reject ⇒ Object
- #republish_count ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(content, metadata, work_queue_name: nil) ⇒ ReceivedMessage
Returns a new instance of ReceivedMessage.
5 6 7 8 9 |
# File 'lib/mercury/received_message.rb', line 5 def initialize(content, , work_queue_name: nil) @content = content = @work_queue_name = work_queue_name end |
Instance Attribute Details
#action_taken ⇒ Object (readonly)
Returns the value of attribute action_taken.
3 4 5 |
# File 'lib/mercury/received_message.rb', line 3 def action_taken @action_taken end |
#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 |
#work_queue_name ⇒ Object (readonly)
Returns the value of attribute work_queue_name.
3 4 5 |
# File 'lib/mercury/received_message.rb', line 3 def work_queue_name @work_queue_name end |
Instance Method Details
#ack ⇒ Object
23 24 25 26 |
# File 'lib/mercury/received_message.rb', line 23 def ack performing_action(:ack) .ack end |
#headers ⇒ Object
15 16 17 |
# File 'lib/mercury/received_message.rb', line 15 def headers (.headers || {}).dup end |
#nack ⇒ Object
33 34 35 36 |
# File 'lib/mercury/received_message.rb', line 33 def nack performing_action(:nack) .reject(requeue: true) end |
#reject ⇒ Object
28 29 30 31 |
# File 'lib/mercury/received_message.rb', line 28 def reject performing_action(:reject) .reject(requeue: false) end |
#republish_count ⇒ Object
19 20 21 |
# File 'lib/mercury/received_message.rb', line 19 def republish_count (.headers[Mercury::REPUBLISH_COUNT_HEADER] || 0).to_i end |
#tag ⇒ Object
11 12 13 |
# File 'lib/mercury/received_message.rb', line 11 def tag headers[Mercury::ORIGINAL_TAG_HEADER] || .routing_key end |