Skip to content

Commit 971deea

Browse files
Edits #2129
1 parent ff0dc93 commit 971deea

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

docs/event-exchange.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,36 +44,55 @@ is a plugin that consumes RabbitMQ internal events and re-publishes them to a
4444
To consume the events, an application needs to declare a queue and bind it to the `amq.rabbitmq.event` exchange.
4545

4646
By default, the plugin declares the topic exchange `amq.rabbitmq.event` in the default virtual host (`/`).
47-
All events are published to this exchange with routing keys (topics) like `exchange.created`, `binding.deleted`. etc.
48-
You can subscribe to only the events you're interested in.
49-
For example, to subscribe to all user events (such as `user.created`, `user.authentication.failure`, etc.) create a binding with binding key `user.#`.
47+
All events are published to this exchange with routing keys (topics) such as `exchange.created`, `binding.deleted`, etc.
48+
Applications can therefore consume only the relevant events.
49+
For example, to subscribe to all user events (such as `user.created`, `user.authentication.failure`, etc.) create a binding with routing (binding) key `user.#`.
5050

5151
The exchange behaves similarly to `amq.rabbitmq.log`: everything gets published there.
52-
If you don't trust a user with the events that get published, don't allow them `read` access to the `amq.rabbitmq.event` exchange.
52+
If application's user cannot be trusted with the events that get published, don't [allow](./access-control) them `read` access to the `amq.rabbitmq.event` exchange.
53+
54+
::: important
55+
56+
All messages published by the internal event mechanism will always have a blank body.
57+
Relevant event attributes are passed in message metadata.
58+
59+
:::
5360

5461
Each event has various event properties associated with it.
5562
By default, the plugin internally publishes AMQP 0.9.1 messages with event properties translated to AMQP 0.9.1 message headers.
5663
The plugin can optionally be configured to internally publish AMQP 1.0 messages with event properties translated to AMQP 1.0 [message-annotations](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#type-message-annotations)
5764
by setting the following in [rabbitmq.conf](configure#config-file):
65+
5866
```
5967
event_exchange.protocol = amqp_1_0
6068
```
61-
The message body is always blank.
69+
70+
All messages published by the internal event mechanism will always have a blank body.
71+
Relevant event attributes are passed in message metadata.
6272

6373
Because the plugin sets event properties as AMQP 0.9.1 headers or AMQP 1.0 message-annotations, client applications can optionally subscribe to only specific event properties (for example all events emitted for a specific user). This can be achieved by binding a queue to a [headers exchange](/tutorials/amqp-concepts#exchange-headers), and the headers exchange to the `amq.rabbitmq.event` topic exchange.
6474

65-
## Events
75+
### Events
6676

6777
Events including their routing keys (topics) that this plugin publishes are documented [here](./logging#internal-events).
6878

69-
## Example
79+
### Example
80+
81+
There's an [example internal event consumer in Java](https://github.com/rabbitmq/rabbitmq-server/tree/main/deps/rabbitmq_event_exchange/examples/java).
7082

71-
You can find a usage example using the Java client [here](https://github.com/rabbitmq/rabbitmq-server/tree/main/deps/rabbitmq_event_exchange/examples/java).
7283

7384
## Plugin Configuration
7485

7586
By default, the `rabbitmq_event_exchange` plugin uses the following configuration:
76-
```
87+
88+
``` ini
7789
event_exchange.vhost = /
7890
event_exchange.protocol = amqp_0_9_1
7991
```
92+
93+
To switch the plugin to publish events in the AMQP 1.0 format, use
94+
95+
``` ini
96+
event_exchange.vhost = /
97+
event_exchange.protocol = amqp_1_0
98+
```

0 commit comments

Comments
 (0)