class AMQP::Client::Message

A message delivered from the broker

Attributes

body[RW]

The message body @return [String]

channel[R]

The channel the message was deliviered to @return [Connection::Channel]

consumer_tag[R]

The tag of the consumer the message was deliviered to @return [String] @return [nil] If the message was polled and not deliviered to a consumer

delivery_tag[R]

The delivery tag of the message, used for acknowledge or reject the message @return [Integer]

exchange[R]

Name of the exchange the message was published to @return [String]

properties[RW]

Message properties @return [Properties]

redelivered[R]

True if the message have been delivered before @return [Boolean]

routing_key[R]

The routing key the message was published with @return [String]

Public Class Methods

new(channel, consumer_tag, delivery_tag, exchange, routing_key, redelivered) click to toggle source

@api private

# File lib/amqp/client/message.rb, line 8
def initialize(channel, consumer_tag, delivery_tag, exchange, routing_key, redelivered)
  @channel = channel
  @consumer_tag = consumer_tag
  @delivery_tag = delivery_tag
  @exchange = exchange
  @routing_key = routing_key
  @redelivered = redelivered
  @properties = nil
  @body = ""
end

Public Instance Methods

ack() click to toggle source

Acknowledge the message @return [nil]

# File lib/amqp/client/message.rb, line 54
def ack
  @channel.basic_ack(@delivery_tag)
end
exchange_name() click to toggle source

@see exchange @deprecated @!attribute [r] exchange_name @return [String]

# File lib/amqp/client/message.rb, line 69
def exchange_name
  @exchange
end
reject(requeue: false) click to toggle source

Reject the message @param requeue [Boolean] If true the message will be put back into the queue again, ready to be redelivered @return [nil]

# File lib/amqp/client/message.rb, line 61
def reject(requeue: false)
  @channel.basic_reject(@delivery_tag, requeue: requeue)
end