Class: AMQP::Client::Message
- Inherits:
-
Object
- Object
- AMQP::Client::Message
- Defined in:
- lib/amqp/client/message.rb
Overview
A message delivered from the broker
Instance Attribute Summary collapse
-
#body ⇒ String
The message body.
-
#channel ⇒ Connection::Channel
readonly
The channel the message was deliviered to.
-
#consumer_tag ⇒ String?
readonly
The tag of the consumer the message was deliviered to.
-
#delivery_tag ⇒ Integer
readonly
The delivery tag of the message, used for acknowledge or reject the message.
-
#exchange ⇒ String
readonly
Name of the exchange the message was published to.
- #exchange_name ⇒ String readonly deprecated Deprecated.
-
#properties ⇒ Properties
Message properties.
-
#redelivered ⇒ Boolean
readonly
True if the message have been delivered before.
-
#routing_key ⇒ String
readonly
The routing key the message was published with.
Instance Method Summary collapse
-
#ack ⇒ nil
Acknowledge the message.
-
#reject(requeue: false) ⇒ nil
Reject the message.
Instance Attribute Details
#body ⇒ String
The message body
51 52 53 |
# File 'lib/amqp/client/message.rb', line 51 def body @body end |
#channel ⇒ Connection::Channel (readonly)
The channel the message was deliviered to
22 23 24 |
# File 'lib/amqp/client/message.rb', line 22 def channel @channel end |
#consumer_tag ⇒ String? (readonly)
The tag of the consumer the message was deliviered to
27 28 29 |
# File 'lib/amqp/client/message.rb', line 27 def consumer_tag @consumer_tag end |
#delivery_tag ⇒ Integer (readonly)
The delivery tag of the message, used for acknowledge or reject the message
31 32 33 |
# File 'lib/amqp/client/message.rb', line 31 def delivery_tag @delivery_tag end |
#exchange ⇒ String (readonly)
Name of the exchange the message was published to
35 36 37 |
# File 'lib/amqp/client/message.rb', line 35 def exchange @exchange end |
#exchange_name ⇒ String (readonly)
78 79 80 |
# File 'lib/amqp/client/message.rb', line 78 def exchange_name @exchange end |
#properties ⇒ Properties
Message properties
47 48 49 |
# File 'lib/amqp/client/message.rb', line 47 def properties @properties end |
#redelivered ⇒ Boolean (readonly)
True if the message have been delivered before
43 44 45 |
# File 'lib/amqp/client/message.rb', line 43 def redelivered @redelivered end |
#routing_key ⇒ String (readonly)
The routing key the message was published with
39 40 41 |
# File 'lib/amqp/client/message.rb', line 39 def routing_key @routing_key end |
Instance Method Details
#ack ⇒ nil
Acknowledge the message
55 56 57 58 59 60 61 |
# File 'lib/amqp/client/message.rb', line 55 def ack return if @ack_or_reject_sent @channel.basic_ack(@delivery_tag) @ack_or_reject_sent = true nil end |
#reject(requeue: false) ⇒ nil
Reject the message
66 67 68 69 70 71 72 |
# File 'lib/amqp/client/message.rb', line 66 def reject(requeue: false) return if @ack_or_reject_sent @channel.basic_reject(@delivery_tag, requeue:) @ack_or_reject_sent = true nil end |