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.
Copy the file
X.Y.Z represent your RabbitMQ
version. Please open a ticket if you need a binary for a different
RabbitMQ version than the one provided.
Install and setup the RabbitMQ Public Umbrella as explained here: http://www.rabbitmq.com/plugin-development.html#getting-started.
cd into the umbrella folder and type:
$ git clone git://github.com/videlalvaro/rabbitmq-recent-history-exchange.git $ cd rabbitmq-recent-history-exchange $ make
Finally copy all the
*.ez files inside the
dist folder to the
$RABBITMQ_HOME/plugins folder. Don't copy the file
rabbit_common-x.y.z since it's not needed inside the broker installation.
To create a recent history exchange, just declare an exchange providing the type
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
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);
In case you would like to not store certain messages, just
add the header
"x-recent-history-no-store" with the value
A future version of RabbitMQ will allow users to disable plugins. When you disable this plugin, it will delete all the cached messages.