Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Event Exchange Plugin docs #2129

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Update Event Exchange Plugin docs #2129

merged 2 commits into from
Nov 15, 2024

Conversation

ansd
Copy link
Member

@ansd ansd commented Nov 14, 2024

This is the docs PR for
rabbitmq/rabbitmq-server#12714 and applies to RabbitMQ >= 4.1

Note that the internal event types were documented previously at three different places:

  1. https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_event_exchange/README.md
  2. https://www.rabbitmq.com/docs/event-exchange
  3. https://www.rabbitmq.com/docs/logging#internal-events

All of them listed different and/or outdated event types. From now on, we use the 3rd place as only place and single source of truth for documenting internal events.

This is the docs PR for
rabbitmq/rabbitmq-server#12714 and applies to
RabbitMQ >= 4.1

Note that the internal event types were documented previously at three
different places:
1. https://github.com/rabbitmq/rabbitmq-server/blob/main/deps/rabbitmq_event_exchange/README.md
2. https://www.rabbitmq.com/docs/event-exchange
3. https://www.rabbitmq.com/docs/logging#internal-events

All of them listed different and/or outdated event types.
From now on, we use the 3rd place as only place and single source of
truth for documenting internal events.
@ansd ansd added this to the 4.1.0 milestone Nov 14, 2024
Copy link

cloudflare-workers-and-pages bot commented Nov 14, 2024

Deploying rabbitmq-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 971deea
Status: ✅  Deploy successful!
Preview URL: https://8d5f1384.rabbitmq-website.pages.dev
Branch Preview URL: https://amqp-event-exchange.rabbitmq-website.pages.dev

View logs

ansd added a commit to rabbitmq/rabbitmq-server that referenced this pull request Nov 14, 2024
 ## What?

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` because of the following sequence:
1. The event exchange plugins listens for all kind of internal events.
2. The event exchange plugin re-publishes all events as AMQP 0.9.1 message to the event exchange.
3. 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.
4. This translation follows the rules outlined in https://www.rabbitmq.com/docs/conversions#amqpl-amqp
5. 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 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
rabbitmq/rabbitmq-website#2129
ansd added a commit to rabbitmq/rabbitmq-server that referenced this pull request Nov 14, 2024
 ## What?

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:
1. The event exchange plugins listens for all kind of internal events.
2. The event exchange plugin re-publishes all events as AMQP 0.9.1 message to the event exchange.
3. 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.
4. This translation follows the rules outlined in https://www.rabbitmq.com/docs/conversions#amqpl-amqp
5. 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.

 ## Documentation
rabbitmq/rabbitmq-website#2129
@ansd ansd marked this pull request as ready for review November 14, 2024 12:02
@michaelklishin michaelklishin merged commit d73fa74 into main Nov 15, 2024
2 checks passed
@michaelklishin michaelklishin deleted the amqp-event-exchange branch November 15, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants