Class: AceMQ::AMQP::Delivery

Inherits:
Struct
  • Object
show all
Defined in:
lib/acemq/amqp/transport.rb

Overview

One message, as it arrived, before any codec has looked at it.

redelivered is the broker saying it has handed these bytes over before — a nack that requeued, or a consumer that died holding the message. It is not how a retry is counted: a requeue hands the broker back the bytes it was given, so the flag says a delivery happened twice and nothing about which attempt this is. That lives in x-acemq-attempt, which the retry engine advances by republishing rather than requeueing.

Settling travels with the delivery as on_ack and on_nack rather than as a delivery tag the consumer would have to hand back to the right channel. That keeps the consumer from knowing which channel a message came down, which is the whole reason a fake transport can stand in for a broker in a test.

reply_to is AMQP's own property and not a header, which is why it is a field here rather than something read out of headers. The Java and .NET libraries write requests with it and nothing else, so a Ruby responder that could not see it could not answer them.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#body ⇒ Object

Returns the value of attribute body

Returns:

  • (Object) —

    the current value of body



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def body
  @body
end

#content_type ⇒ Object

Returns the value of attribute content_type

Returns:

  • (Object) —

    the current value of content_type



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def content_type
  @content_type
end

#headers ⇒ Object

Returns the value of attribute headers

Returns:

  • (Object) —

    the current value of headers



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def headers
  @headers
end

#message_id ⇒ Object

Returns the value of attribute message_id

Returns:

  • (Object) —

    the current value of message_id



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def message_id
  @message_id
end

#on_ack ⇒ Object

Returns the value of attribute on_ack

Returns:

  • (Object) —

    the current value of on_ack



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def on_ack
  @on_ack
end

#on_nack ⇒ Object

Returns the value of attribute on_nack

Returns:

  • (Object) —

    the current value of on_nack



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def on_nack
  @on_nack
end

#redelivered ⇒ Object

Returns the value of attribute redelivered

Returns:

  • (Object) —

    the current value of redelivered



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def redelivered
  @redelivered
end

#reply_to ⇒ Object

Returns the value of attribute reply_to

Returns:

  • (Object) —

    the current value of reply_to



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def reply_to
  @reply_to
end

#routing_key ⇒ Object

Returns the value of attribute routing_key

Returns:

  • (Object) —

    the current value of routing_key



404
405
406
# File 'lib/acemq/amqp/transport.rb', line 404

def routing_key
  @routing_key
end

Instance Method Details

#ack ⇒ Object

Confirms the message. It will not be sent again.



411
# File 'lib/acemq/amqp/transport.rb', line 411

def ack = on_ack&.call

#nack(requeue: false) ⇒ Object

Returns the message, requeued or not.



414
# File 'lib/acemq/amqp/transport.rb', line 414

def nack(requeue: false) = on_nack&.call(requeue)

#redelivered? ⇒ Boolean

Returns:

  • (Boolean)


408
# File 'lib/acemq/amqp/transport.rb', line 408

def redelivered? = !!redelivered