You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/event-exchange.md
+28-9Lines changed: 28 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,36 +44,55 @@ is a plugin that consumes RabbitMQ internal events and re-publishes them to a
44
44
To consume the events, an application needs to declare a queue and bind it to the `amq.rabbitmq.event` exchange.
45
45
46
46
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.#`.
50
50
51
51
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
+
:::
53
60
54
61
Each event has various event properties associated with it.
55
62
By default, the plugin internally publishes AMQP 0.9.1 messages with event properties translated to AMQP 0.9.1 message headers.
56
63
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)
57
64
by setting the following in [rabbitmq.conf](configure#config-file):
65
+
58
66
```
59
67
event_exchange.protocol = amqp_1_0
60
68
```
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.
62
72
63
73
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.
64
74
65
-
## Events
75
+
###Events
66
76
67
77
Events including their routing keys (topics) that this plugin publishes are documented [here](./logging#internal-events).
68
78
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).
70
82
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).
72
83
73
84
## Plugin Configuration
74
85
75
86
By default, the `rabbitmq_event_exchange` plugin uses the following configuration:
76
-
```
87
+
88
+
```ini
77
89
event_exchange.vhost = /
78
90
event_exchange.protocol = amqp_0_9_1
79
91
```
92
+
93
+
To switch the plugin to publish events in the AMQP 1.0 format, use
0 commit comments