rabbitmq-server/deps/rabbitmq_event_exchange
Michael Davis 52a0d70e15
Handle database timeouts when declaring exchanges
The spec of `rabbit_exchange:declare/7` needs to be updated to return
`{ok, Exchange} | {error, Reason}` instead of the old return value of
`rabbit_types:exchange()`. This is safe to do since `declare/7` is not
called by RPC - from the CLI or otherwise - outside of test suites, and
in test suites only through the CLI's `TestHelper.declare_exchange/7`.
Callers of this helper are updated in this commit.

Otherwise this commit updates callers to unwrap the `{ok, Exchange}`
and bubble up errors.
2024-07-22 16:02:03 -04:00
..
examples/java Fix compilation error in QueueEvents 2016-06-07 00:16:08 -04:00
include Use an exchange decorator to drop all events when no binding is present 2018-10-31 12:46:35 +00:00
priv/schema Expose rabbitmq_event_exchange.vhost to new style config 2018-08-14 08:25:06 -07:00
src Handle database timeouts when declaring exchanges 2024-07-22 16:02:03 -04:00
test More (c) source header updates #9969 2024-01-19 19:53:28 -05:00
.gitignore Cleanup .gitignore files for the monorepo 2024-06-28 12:00:52 +02:00
BUILD.bazel Use gazelle generated bazel files 2023-04-17 18:13:18 +02:00
CODE_OF_CONDUCT.md Replace files with symlinks 2022-04-15 06:04:29 -07:00
CONTRIBUTING.md Replace files with symlinks 2022-04-15 06:04:29 -07:00
LICENSE Replace @rabbitmq.com addresses with rabbitmq-core@groups.vmware.com 2023-06-20 15:40:13 +04:00
LICENSE-MPL-RabbitMQ Switch to Mozilla Public License 2.0 (MPL 2.0) 2020-07-12 22:47:07 +01:00
Makefile Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
README.md Event exchange: README.md updates 2023-04-15 14:25:18 +04:00
app.bzl Replace globs in bazel with explicit lists of files 2023-04-25 17:29:12 +02:00

README.md

RabbitMQ Event Exchange

Overview

This plugin exposes the internal RabbitMQ event mechanism as messages that clients can consume. It's useful if you want to keep track of certain events, e.g. when queues, exchanges, bindings, users, connections, channels are created and deleted. This plugin filters out stats events, so you are almost certainly going to get better results using the management plugin for stats.

How it Works

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.

Installation

This plugin ships with RabbitMQ. Like with all other plugins, it must be enabled before it can be used:

[sudo] rabbitmq-plugins enable rabbitmq_event_exchange

Event format

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

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

RabbitMQ Broker

Queue, Exchange and Binding events:

  • queue.deleted
  • queue.created
  • exchange.created
  • exchange.deleted
  • binding.created
  • binding.deleted

Connection and Channel events:

  • connection.created
  • connection.closed
  • channel.created
  • channel.closed

Consumer events:

  • consumer.created
  • consumer.deleted

Policy and Parameter events:

  • policy.set
  • policy.cleared
  • parameter.set
  • parameter.cleared

Virtual host events:

  • vhost.created
  • vhost.deleted
  • vhost.limits.set
  • vhost.limits.cleared

User related events:

  • user.authentication.success
  • user.authentication.failure
  • user.created
  • user.deleted
  • user.password.changed
  • user.password.cleared
  • user.tags.set

Permission events:

  • permission.created
  • permission.deleted
  • topic.permission.created
  • topic.permission.deleted

Alarm events:

  • alarm.set
  • alarm.cleared

Shovel Plugin

Worker events:

  • shovel.worker.status
  • shovel.worker.removed

Federation Plugin

Link events:

  • federation.link.status
  • federation.link.removed

Example

There is a usage example using the Java client in examples/java.

Configuration

  • rabbitmq_event_exchange.vhost: what vhost should the amq.rabbitmq.event exchange be declared in. Default: rabbit.default_vhost (<<"/">>).

Uninstalling

If you want to remove the exchange which this plugin creates, first disable the plugin and restart the broker. Then you can delete the exchange, e.g. with :

rabbitmqctl eval 'rabbit_exchange:delete(rabbit_misc:r(<<"/">>, exchange, <<"amq.rabbitmq.event">>), false, <<"username">>).'

Building from Source

Building is no different from building other RabbitMQ plugins.

TL;DR:

git clone https://github.com.com/rabbitmq/rabbitmq-public-umbrella.git umbrella
cd umbrella
make co
make up BRANCH=stable
cd deps
git clone https://github.com/rabbitmq/rabbitmq-event-exchange.git rabbitmq_event_exchange
cd rabbitmq_event_exchange
make dist

License

Released under the Mozilla Public License 2.0, the same as RabbitMQ.