rabbitmq-server/deps/rabbitmq_recent_history_exc...
Rin Kuryloski a944439fba Replace globs in bazel with explicit lists of files
As this is preferred in rules_erlang 3.9.14
2023-04-25 17:29:12 +02:00
..
etc adds multinode tests 2014-09-23 19:16:25 +02:00
include (c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
src Unit test rabbit_db_* modules, spec and API updates 2023-02-02 15:01:42 +01:00
test (c) year bump: 2022 => 2023 2023-01-01 23:17:36 -05:00
.gitignore Git: Ignore copied CLI 2019-12-12 15:04:35 +01: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 Update LICENSE 2020-07-20 12:08:32 +01:00
LICENSE-MPL-RabbitMQ Revert drop of Exhibit B on MPL 2.0 2020-07-20 17:03:05 +01:00
Makefile Update Erlang.mk and switch to new xref code 2022-05-31 13:51:12 +02:00
README.md Recent history exchange: README.md updates 2023-04-15 14:24:02 +04:00
app.bzl Replace globs in bazel with explicit lists of files 2023-04-25 17:29:12 +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.