Class: Twingly::AMQP::Message
- Inherits:
-
Object
- Object
- Twingly::AMQP::Message
- Defined in:
- lib/twingly/amqp/message.rb
Instance Attribute Summary collapse
-
#delivery_info ⇒ Object
readonly
Returns the value of attribute delivery_info.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #ack ⇒ Object
-
#initialize(delivery_info:, metadata:, payload:, channel:) ⇒ Message
constructor
A new instance of Message.
- #reject ⇒ Object
- #requeue ⇒ Object
Constructor Details
#initialize(delivery_info:, metadata:, payload:, channel:) ⇒ Message
Returns a new instance of Message.
6 7 8 9 10 11 |
# File 'lib/twingly/amqp/message.rb', line 6 def initialize(delivery_info:, metadata:, payload:, channel:) @delivery_info = delivery_info = @payload = parse_payload(payload) @channel = channel end |
Instance Attribute Details
#delivery_info ⇒ Object (readonly)
Returns the value of attribute delivery_info.
4 5 6 |
# File 'lib/twingly/amqp/message.rb', line 4 def delivery_info @delivery_info end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/twingly/amqp/message.rb', line 4 def end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
4 5 6 |
# File 'lib/twingly/amqp/message.rb', line 4 def payload @payload end |
Instance Method Details
#ack ⇒ Object
13 14 15 |
# File 'lib/twingly/amqp/message.rb', line 13 def ack @channel.ack(@delivery_info.delivery_tag) end |
#reject ⇒ Object
21 22 23 |
# File 'lib/twingly/amqp/message.rb', line 21 def reject @channel.reject(@delivery_info.delivery_tag, false) end |
#requeue ⇒ Object
17 18 19 |
# File 'lib/twingly/amqp/message.rb', line 17 def requeue @channel.reject(@delivery_info.delivery_tag, true) end |