Git Product home page Git Product logo

rabbitmq-recent-history-exchange's Introduction

RabbitMQ Recent History Exchange

This repository has been moved to the main unified RabbitMQ "monorepo", including all open issues. You can find the source under /deps/rabbitmq_recent_history_exchange. All issues have been transferred.

Overview

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 Type: x-recent-history

Installation

RabbitMQ 3.6.0 or later

As of RabbitMQ 3.6.0 this plugin is included into the RabbitMQ distribution.

Enable it with the following command:

rabbitmq-plugins enable rabbitmq_recent_history_exchange

With Earlier Versions

Install the corresponding .ez files from our Community Plugins archive..

Then run the following command:

rabbitmq-plugins enable rabbitmq_recent_history_exchange

Building from Source

Please see RabbitMQ Plugin Development guide.

To build the plugin:

git clone git://github.com/rabbitmq/rabbitmq-recent-history-exchange.git
cd rabbitmq-recent-history-exchange
make

Then copy all the *.ez files inside the plugins folder to the RabbitMQ plugins directory and enable the plugin:

[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.

rabbitmq-recent-history-exchange's People

Contributors

dumbbell avatar michaelklishin avatar videlalvaro avatar gerhard avatar lukebakken avatar kjnilsson avatar mweibel avatar carlhoerberg avatar hyperthunk avatar acogoluegnes avatar dcorbacho avatar legoscia avatar fenollp avatar spring-operator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.