1.5.16. Message Conversion Between AMQP 0-10 and AMQP 1.0
Messages sent over AMQP 0-10 are converted by the broker for sending over AMQP 1.0, and vice versa.
The
message-id
, correlation-id
, userid
, content-type
and content-encoding
map between the properties
section in 1.0 and the message-properties
in an 0-10 header. Note, however, that a 0-10 message-id
must be a UUID. This field is skipped when translating a 1.0 message to 0-10 if it does not contain a valid UUID.
The
priority
field in the header section of a 1.0 message maps to the priority
field in the delivery-properties
of an 0-10 message. The durable
header in a 1.0 message is equivalent to the delivery-mode
in the delivery-properties
of an 0-10 message, with a value of true
in the former being equivalent to a value of 2 in the latter and a value of false
in the former equivalent to 1 in the latter.
When converting from 0-10 to 1.0, if no exchange is set, then the
reply-to
is the routing-key
. If the exchange is set then the reply-to
address for 1.0 is composed from the exchange and any routing key (separated by a forward slash).
Note that the client assumes the
reply-to
address is a queue if no type is specified. To ensure that a 0-10 routing-key
for an exchange is correctly converted to a 1.0 reply-to
, specify the node type in the 0-10 address, for instance 'amq.direct/rk; {node:{type:topic}}
', or set the type on the Address instance.
When converting from 0-10 to 1.0, if the 0-10 message has a non-empty destination, then the
subject
field in the properties
of the 1.0 message is set to the value of the routing-key
from the message-properties
of the 0-10 message. In the reverse direction, the subject
field of the properties
section of the 1.0 message populates the routing-key
in the message-properties
of the 0-10 message. Note that the routing-key
truncates at 255 characters.
The destination of a 0-10 message is used to populate the '
to
' field of the properties
section when converting to 1.0, but the reverse translation is not done (as the destination for messages sent out by the broker is controlled by the subscription in 0-10).
The
application-properties
section of a 1.0 message is converted to the application-headers
field in the message-properties
of an 0-10 message and vice versa.
When converting
reply-to
from 1.0 to 0-10, if the address contains a forward slash it is assumed to be of the form exchange/routing key. If it does not contain a forward slash, it is assumed to be a simple node name. If that name matches an existing queue, then the resulting 0-10 reply-to
will have the exchange empty and the routing key populated with the queue name. If the name does not match an existing queue, but the name matches an exchange, then the reply-to
has the exchange populated with the node name and the routing key left empty. If the node refers to neither a known queue nor exchange then the resulting reply-to
will be empty.