Class: GovukMessageQueueConsumer::Message
- Inherits:
-
Object
- Object
- GovukMessageQueueConsumer::Message
- Defined in:
- lib/govuk_message_queue_consumer/message.rb
Overview
Client code will receive an instance of this
Direct Known Subclasses
Instance Attribute Summary collapse
-
#delivery_info ⇒ Object
Returns the value of attribute delivery_info.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #ack ⇒ Object
- #discard ⇒ Object
-
#initialize(payload, headers, delivery_info) ⇒ Message
constructor
A new instance of Message.
- #retry ⇒ Object
Constructor Details
#initialize(payload, headers, delivery_info) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 6 def initialize(payload, headers, delivery_info) @payload = payload @headers = headers @delivery_info = delivery_info @status = :status end |
Instance Attribute Details
#delivery_info ⇒ Object
Returns the value of attribute delivery_info.
4 5 6 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 4 def delivery_info @delivery_info end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 4 def headers @headers end |
#payload ⇒ Object
Returns the value of attribute payload.
4 5 6 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 4 def payload @payload end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 4 def status @status end |
Instance Method Details
#ack ⇒ Object
13 14 15 16 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 13 def ack @delivery_info.channel.ack(@delivery_info.delivery_tag) @status = :acked end |
#discard ⇒ Object
23 24 25 26 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 23 def discard @delivery_info.channel.reject(@delivery_info.delivery_tag, false) @status = :discarded end |
#retry ⇒ Object
18 19 20 21 |
# File 'lib/govuk_message_queue_consumer/message.rb', line 18 def retry @delivery_info.channel.reject(@delivery_info.delivery_tag, true) @status = :retried end |