Prior to this commit, the rabbitmq_event_exchange internally published
always AMQP 0.9.1 messages to the amq.rabbitmq.event topic exchange.
This commit allows users to configure the plugin to publish AMQP 1.0
messages instead.
Why?
Prior to this commit, when an AMQP 1.0 client consumed events,
event properties that are lists were omitted. For example property
client_properties of event connection.created or property
arguments of event queue.created were omitted because of the following sequence:
The event exchange plugins listens for all kind of internal events.
The event exchange plugin re-publishes all events as AMQP 0.9.1 message to the event exchange.
Later, when an AMQP 1.0 client consumes this message, the broker must translate the message from AMQP 0.9.1 to AMQP 1.0.
Specifically, in this table the row before the last one describes the rule we're hitting here. It says that if the AMQP 0.9.1
header value is not an x- prefixed header and its value is an array or table, then this header is not converted.
That's because AMQP 1.0 application-properties must be simple types as mandated in https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-properties
How?
The user can configure the plugin as follows to have the plugin
internally publish AMQP 1.0 messages:
event_exchange.protocol = amqp_1_0
To support complex types such as lists, the plugin sets all event
properties as AMQP 1.0 message-annotations. The plugin prefixes all message
annotation keys with x-opt- to comply with the AMQP 1.0 spec.
Alternative Design
An alternative design would have been to format all event properties
e.g. as JSON within the message body. However, this breaks routing on
specific event property values via a headers exchange.
What?
Prior to this commit, the
rabbitmq_event_exchange
internally published always AMQP 0.9.1 messages to theamq.rabbitmq.event
topic exchange. This commit allows users to configure the plugin to publish AMQP 1.0 messages instead.Why?
Prior to this commit, when an AMQP 1.0 client consumed events, event properties that are lists were omitted. For example property
client_properties
of eventconnection.created
or propertyarguments
of eventqueue.created
were omitted because of the following sequence:Specifically, in this table the row before the last one describes the rule we're hitting here. It says that if the AMQP 0.9.1 header value is not an
x-
prefixed header and its value is an array or table, then this header is not converted. That's because AMQP 1.0 application-properties must be simple types as mandated in https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-application-propertiesHow?
The user can configure the plugin as follows to have the plugin internally publish AMQP 1.0 messages:
To support complex types such as lists, the plugin sets all event properties as AMQP 1.0 message-annotations. The plugin prefixes all message annotation keys with
x-opt-
to comply with the AMQP 1.0 spec.Alternative Design
An alternative design would have been to format all event properties e.g. as JSON within the message body. However, this breaks routing on specific event property values via a headers exchange.
Documentation
https://github.com/rabbitmq/rabbitmq-website/pull/2129