[Why] Once `khepr_db` is enabled by default, we need another way to disable it to select Mnesia instead. [How] We use the new relative forced feature flags mechanism to indicate if we want to explicitly enable or disable `khepri_db`. This way, we don't touch other stable feature flags and only mess with Khepri. However, this mechanism is not supported by RabbitMQ 4.0.x and older. They will ignore the setting. Therefore, to make this work in mixed-version testing, we set the `$RABBITMQ_FEATURE_FLAGS` variable for the secondary umbrella. This part will go away once we test against RabbitMQ 4.1.x as the secondary umbrella in the future. At the end, we compare the effective metadata store to the expected one. If they don't match, we skip the test. While here, change `rjms_topic_selector_SUITE` to only choose Khepri without specifying any feature flags. |
||
---|---|---|
.. | ||
etc | ||
include | ||
src | ||
test | ||
BUILD.bazel | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
LICENSE-MPL-RabbitMQ | ||
Makefile | ||
README.md | ||
app.bzl |
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
When you disable this plugin, it will delete all the cached messages.
License
See LICENSE.