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
50 51 52 |
# File 'lib/amqp/client/message.rb', line 50 def body @body end |
#channel ⇒ Connection::Channel (readonly)
The channel the message was deliviered to
21 22 23 |
# File 'lib/amqp/client/message.rb', line 21 def channel @channel end |
#consumer_tag ⇒ String? (readonly)
The tag of the consumer the message was deliviered to
26 27 28 |
# File 'lib/amqp/client/message.rb', line 26 def consumer_tag @consumer_tag end |
#delivery_tag ⇒ Integer (readonly)
The delivery tag of the message, used for acknowledge or reject the message
30 31 32 |
# File 'lib/amqp/client/message.rb', line 30 def delivery_tag @delivery_tag end |
#exchange ⇒ String (readonly)
Name of the exchange the message was published to
34 35 36 |
# File 'lib/amqp/client/message.rb', line 34 def exchange @exchange end |
#exchange_name ⇒ String (readonly)
69 70 71 |
# File 'lib/amqp/client/message.rb', line 69 def exchange_name @exchange end |
#properties ⇒ Properties
Message properties
46 47 48 |
# File 'lib/amqp/client/message.rb', line 46 def properties @properties end |
#redelivered ⇒ Boolean (readonly)
True if the message have been delivered before
42 43 44 |
# File 'lib/amqp/client/message.rb', line 42 def redelivered @redelivered end |
#routing_key ⇒ String (readonly)
The routing key the message was published with
38 39 40 |
# File 'lib/amqp/client/message.rb', line 38 def routing_key @routing_key end |
Instance Method Details
#ack ⇒ nil
Acknowledge the message
54 55 56 |
# File 'lib/amqp/client/message.rb', line 54 def ack @channel.basic_ack(@delivery_tag) end |
#reject(requeue: false) ⇒ nil
Reject the message
61 62 63 |
# File 'lib/amqp/client/message.rb', line 61 def reject(requeue: false) @channel.basic_reject(@delivery_tag, requeue: requeue) end |