Event Exchange Plugin

Overview

Client connection, channels, queues, consumers, and other parts of the system naturally generate events. For example, when a connection is accepted, authenticated and access to the target virtual host is authorised, it will emit an event of type connection_created. When a connection is closed or fails for any reason, a connection_closed event is deleted.

Monitoring and auditing services can be interested in observing those events. RabbitMQ has a minimalistic mechanism for event notifications that can be exposed to RabbitMQ clients with a plugin.

Consuming Internal Events with rabbitmq-event-exchange Plugin

rabbitmq-event-exchange is a plugin that consumes internal events and re-publishes them to a topic exchange, thus exposing the events to clients (applications).

To consume the events, an application needs to declare a queue, bind it to a special system exchange and consume messages.

It declares a topic exchange called amq.rabbitmq.event in the default virtual host. All events are published to this exchange with routing keys like 'exchange.created', 'binding.deleted' etc, so you can subscribe to only the events you're interested in.

The exchange behaves similarly to amq.rabbitmq.log: everything gets published there; if you don't trust a user with the information that gets published, don't allow them access.

The plugin requires no configuration, just activate it:

rabbitmq-plugins enable rabbitmq_event_exchange

Each event has various properties associated with it. These are translated into AMQP 0-9-1 data encoding and inserted in the message headers. The message body is always blank.

Events

RabbitMQ and related plugins emit events with the following routing keys:

RabbitMQ Broker

Queue, Exchange and Binding events:

Connection and Channel events:

Consumer events:

Policy and Parameter events:

Virtual host events:

User related events:

Permission events:

Shovel Plugin

Worker events:

Federation Plugin

Link events:

Example

There is a usage example using the Java client in the rabbitmq-event-exchange repository.