rabbitmq-server/deps/rabbitmq_recent_history_exc...
Loïc Hoguin bbfa066d79
Cleanup .gitignore files for the monorepo
We don't need to duplicate so many patterns in so many
files since we have a monorepo (and want to keep it).

If I managed to miss something or remove something that
should stay, please put it back. Note that monorepo-wide
patterns should go in the top-level .gitignore file.
Other .gitignore files are for application or folder-
specific patterns.
2024-06-28 12:00:52 +02:00
..
etc adds multinode tests 2014-09-23 19:16:25 +02:00
include More missed (c) header updates 2024-01-23 11:26:29 -05:00
src Remove unused imports (thanks elp!) 2024-05-23 16:36:08 +02:00
test recent history exchange: Test plugin boot and cleanup steps 2024-04-14 08:32:54 -04:00
BUILD.bazel Allow to use Khepri database to store metadata instead of Mnesia 2023-09-29 16:00:11 +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 Revert drop of Exhibit B on MPL 2.0 2020-07-20 17:03:05 +01:00
Makefile Set PLT_APPS in a number of plugins where it was missing 2024-04-29 14:54:28 +02:00
README.md Recent history exchange: README.md updates 2023-04-15 14:24:02 +04:00
app.bzl Allow to use Khepri database to store metadata instead of Mnesia 2023-09-29 16:00:11 +02:00

README.md

RabbitMQ Recent History Cache

Keeps track of the last 20 messages that passed through the exchange. Every time a queue is bound to the exchange it delivers that last 20 messages to them. This is useful for implementing a very simple Chat History where clients that join the conversation can get the latest messages.

Exchange yype: x-recent-history.

Installation

This plugin ships with RabbitMQ.

Like all other plugins, it must be enabled before it can be used:

[sudo] rabbitmq-plugins enable rabbitmq_recent_history_exchange

Usage

Creating an exchange

To create a recent history exchange, just declare an exchange providing the type "x-recent-history".

channel.exchangeDeclare("logs", "x-recent-history");

Providing a custom history length

Typically this exchange will store the latest 20 messages sent over the exchange. If you want to set a different cache length, then you can pass a "x-recent-history-length" argument to exchange.declare. The argument must be an integer greater or equal to zero.

For example in Java:

Map<String, Object> args = new HashMap<String, Object>();
args.put("x-recent-history-length", 60);
channel.exchangeDeclare("rh", "x-recent-history", false, false, args);

Preventing some messages from being stored

In case you would like to not store certain messages, just add the header "x-recent-history-no-store" with the value true to the message.

Disabling the Plugin

A future version of RabbitMQ will allow users to disable plugins. When you disable this plugin, it will delete all the cached messages.

License

See LICENSE.