noxdafox / rabbitmq-message-deduplication

RabbitMQ Plugin for filtering message duplicates
Mozilla Public License 2.0
271 stars 33 forks source link
exchange filtering-message-duplicates message-deduplication rabbitmq rabbitmq-plugin

RabbitMQ Message Deduplication Plugin

Build Status

A plugin for filtering duplicate messages.

Messages can be deduplicated when published into an exchange or enqueued to a queue.

Installing

Download the .ez files from the chosen release and copy them into the RabbitMQ plugins directory.

Check the Release notes for minimum supported versions.

Enable the plugin:

    [sudo] rabbitmq-plugins enable rabbitmq_message_deduplication

Building from Source

Please see RabbitMQ Plugin Development guide.

To build the plugin:

    git clone https://github.com/noxdafox/rabbitmq-message-deduplication.git
    cd rabbitmq-message-deduplication
    make dist

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

    [sudo] rabbitmq-plugins enable rabbitmq_message_deduplication

Version requirements

The latest version of the plugin requires RabbitMQ 3.13.0.

Earlier RabbitMQ versions are supported by 0.6.2.

Exchange level deduplication

The exchange type x-message-deduplication allows to filter message duplicates before any routing rule is applied.

Each message containing the x-deduplication-header header will not be routed if its value has been submitted previously. The amount of time a given message will be guaranteed to be unique can be controlled via the x-cache-ttl exchange argument or message header.

NOTE; This exchange acts like a fanout exchange, so routing rules are not applied.

Declare an exchange

To create a message deduplication exchange, just declare it providing the type x-message-deduplication.

Required arguments:

Optional arguments:

Message headers

Queue level deduplication

A queue declared with the x-message-deduplication parameter enabled will filter message duplicates before they are published within.

Each message containing the x-deduplication-header header will not be enqueued if another message with the same header is already present within the queue.

NOTE: Mirrored and Quorum queues are currently not supported.

Declare a queue

When declaring a queue, it is possible to enable message deduplication via the x-message-deduplication boolean argument.

Message headers

Disabling the Plugin

It is possible to disable the plugin via the command:

    [sudo] rabbitmq-plugins disable rabbitmq_message_deduplication

All deduplication exchanges and queues will be rendered non functional. It is responsibility of the User to remove them.

Running the tests

    make tests

License

See the LICENSE file.