All Projects → rabbitmq → Rabbitmq Delayed Message Exchange

rabbitmq / Rabbitmq Delayed Message Exchange

Licence: other
Delayed Messaging for RabbitMQ

Programming Languages

erlang
1774 projects

Projects that are alternatives of or similar to Rabbitmq Delayed Message Exchange

Rabbitmq Consistent Hash Exchange
RabbitMQ Consistent Hash Exchange Type
Stars: ✭ 189 (-80.75%)
Mutual labels:  plugin, rabbitmq, exchange
Yii2 Rabbitmq
RabbitMQ Extension for Yii2
Stars: ✭ 52 (-94.7%)
Mutual labels:  rabbitmq, exchange
Rabbitmq Message Deduplication
RabbitMQ Plugin for filtering message duplicates
Stars: ✭ 139 (-85.85%)
Mutual labels:  rabbitmq, exchange
Rabbitmq Event Exchange
Expose broker events as messages
Stars: ✭ 75 (-92.36%)
Mutual labels:  rabbitmq, exchange
Rabbitmq Prometheus
A minimalistic Prometheus exporter of core RabbitMQ metrics
Stars: ✭ 124 (-87.37%)
Mutual labels:  plugin, rabbitmq
Condition Circle
Checks CircleCI environment before publishing successful build using semantic-release
Stars: ✭ 32 (-96.74%)
Mutual labels:  plugin
Oci Grafana Metrics
Grafana datasource plugin for OCI metrics
Stars: ✭ 34 (-96.54%)
Mutual labels:  plugin
Formality
Forms made simple (and cute). Designless, multistep, conversational, secure, all-in-one WordPress forms plugin.
Stars: ✭ 30 (-96.95%)
Mutual labels:  plugin
Framework7 Upscroller Plugin
A little framework7 plugin to give users a button to scroll up
Stars: ✭ 31 (-96.84%)
Mutual labels:  plugin
Neoformat
✨ A (Neo)vim plugin for formatting code.
Stars: ✭ 977 (-0.51%)
Mutual labels:  plugin
Ununiga
[은는이가] 한글 조사(助詞) 대응 I18n engine extension
Stars: ✭ 34 (-96.54%)
Mutual labels:  plugin
Guitard
Node based multi effects audio processor
Stars: ✭ 31 (-96.84%)
Mutual labels:  plugin
Zsh Lazyload
zsh plugin for lazy load commands and speed up start up time of zsh
Stars: ✭ 33 (-96.64%)
Mutual labels:  plugin
Segment Open
Segment Source Distribution
Stars: ✭ 34 (-96.54%)
Mutual labels:  plugin
Rabbitmq Java Client
RabbitMQ Java client
Stars: ✭ 964 (-1.83%)
Mutual labels:  rabbitmq
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (-0.51%)
Mutual labels:  rabbitmq
Streamsx.messaging
This toolkit is focused on interacting with popular messaging systems such as Kafka, JMS, XMS, and MQTT. After release v5.4.2 the complete toolkit will be deprecated. See the README.md file for hints to alternative toolkits.
Stars: ✭ 31 (-96.84%)
Mutual labels:  rabbitmq
Samp Plugin Profiler
Performance profiler plugin for SA-MP server
Stars: ✭ 33 (-96.64%)
Mutual labels:  plugin
Appleseed Max
appleseed plugin for Autodesk® 3ds Max®
Stars: ✭ 34 (-96.54%)
Mutual labels:  plugin
Oc Toolbox Plugin
🧰 Toolbox plugin for October CMS
Stars: ✭ 33 (-96.64%)
Mutual labels:  plugin

RabbitMQ Delayed Message Plugin

This plugin adds delayed-messaging (or scheduled-messaging) to RabbitMQ.

A user can declare an exchange with the type x-delayed-message and then publish messages with the custom header x-delay expressing in milliseconds a delay time for the message. The message will be delivered to the respective queues after x-delay milliseconds.

Supported RabbitMQ Versions

The most recent release of this plugin targets RabbitMQ 3.8.x. Earlier series are out of support.

Supported Erlang/OTP Versions

This plugin requires Erlang 22 or later versions, same as RabbitMQ 3.8.x.

Project Maturity

This plugin is considered to be experimental yet fairly stable and potential suitable for production use as long as the user is aware of its limitations.

It had a few issues and one fundamental problem fixed in its ~ 18 months of existence. It is known to work reasonably well for some users. It also has known limitations (see a section below), including those related to the replication of delayed and messages and the number of delayed messages.

This plugin is not commercially supported by Pivotal at the moment but it doesn't mean that it will be abandoned or team RabbitMQ is not interested in improving it in the future. It is not, however, a high priority for our small team.

So, give it a try with your workload and decide for yourself.

Installation

Binary Builds

Binary builds are available on GitHub.

Enabling the Plugin

Then run the following command:

rabbitmq-plugins enable rabbitmq_delayed_message_exchange

Usage

To use the delayed-messaging feature, declare an exchange with the type x-delayed-message:

// ... elided code ...
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-delayed-type", "direct");
channel.exchangeDeclare("my-exchange", "x-delayed-message", true, false, args);
// ... more code ...

Note that we pass an extra header called x-delayed-type, more on it under the Routing section.

Once we have the exchange declared we can publish messages providing a header telling the plugin for how long to delay our messages:

// ... elided code ...
byte[] messageBodyBytes = "delayed payload".getBytes("UTF-8");
Map<String, Object> headers = new HashMap<String, Object>();
headers.put("x-delay", 5000);
AMQP.BasicProperties.Builder props = new AMQP.BasicProperties.Builder().headers(headers);
channel.basicPublish("my-exchange", "", props.build(), messageBodyBytes);

byte[] messageBodyBytes2 = "more delayed payload".getBytes("UTF-8");
Map<String, Object> headers2 = new HashMap<String, Object>();
headers2.put("x-delay", 1000);
AMQP.BasicProperties.Builder props2 = new AMQP.BasicProperties.Builder().headers(headers2);
channel.basicPublish("my-exchange", "", props2.build(), messageBodyBytes2);
// ... more code ...

In the above example we publish two messages, specifying the delay time with the x-delay header. For this example, the plugin will deliver to our queues first the message with the body "more delayed payload" and then the one with the body "delayed payload".

If the x-delay header is not present, then the plugin will proceed to route the message without delay.

Routing

This plugin allows for flexible routing via the x-delayed-type arguments that can be passed during exchange.declare. In the example above we used "direct" as exchange type. That means the plugin will have the same routing behavior shown by the direct exchange.

If you want a different routing behavior, then you could provide a different exchange type, like "topic" for example. You can also specify exchange types provided by plugins. Note that this argument is required and must refer to an existing exchange type.

Performance Impact

Due to the "x-delayed-type" argument, one could use this exchange in place of other exchanges, since the "x-delayed-message" exchange will just act as proxy. Note that there might be some performance implications if you do this.

For each message that crosses an "x-delayed-message" exchange, the plugin will try to determine if the message has to be expired by making sure the delay is within range, ie: Delay > 0, Delay =< ?ERL_MAX_T (In Erlang a timer can be set up to (2^32)-1 milliseconds in the future).

If the previous condition holds, then the message will be persisted to Mnesia and some other logic will kick in to determine if this particular message delay needs to replace the current scheduled timer and so on.

This means that while one could use this exchange in place of a direct or fanout exchange (or any other exchange for that matter), it will be slower than using the actual exchange. If you don't need to delay messages, then use the actual exchange.

Limitations

Delayed messages are stored in a Mnesia table (also see Limitations below) with a single disk replica on the current node. They will survive a node restart. While timer(s) that triggered scheduled delivery are not persisted, it will be re-initialised during plugin activation on node start. Obviously, only having one copy of a scheduled message in a cluster means that losing that node or disabling the plugin on it will lose the messages residing on that node.

This plugin was created with disk nodes in mind. RAM nodes are currently unsupported and adding support for them is not a priority (if you aren't sure what RAM nodes are and whether you need to use them, you almost certainly don't).

The plugin only performs one attempt at publishing each message but since publishing is local, in practice the only issue that may prevent delivery is the lack of queues (or bindings) to route to.

Closely related to the above, the mandatory flag is not supported by this exchange: we cannot be sure that at the future publishing point in time

  • there is at least one queue we can route to
  • the original connection is still around to send a basic.return to

Current design of this plugin doesn't really fit scenarios with a high number of delayed messages (e.g. 100s of thousands or millions). See #72 for details.

Disabling the Plugin

You can disable this plugin by calling rabbitmq-plugins disable rabbitmq_delayed_message_exchange but note that ALL DELAYED MESSAGES THAT HAVEN'T BEEN DELIVERED WILL BE LOST.

LICENSE

See the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].