One of the main reasons for RabbitMQ to be the most deployed message broker must be considered to be the ability to tweak the broker into a product perfect for its purpose.
CloudAMQP have during the years seen a lot of RabbitMQ use-cases, all of them from a wide spectrum of settings and configurations, made to meet the demand of their product or company. And why not share these useful insights?
A RabbitMQ broker offers a lot of built-in shelf features like routing, clustering, and persistence. Still, enabling RabbitMQ plugins can enhance your broker’s default capabilities.
This blog post will give you an understanding of how plugins can be found and enabled and in which ways they can be successfully used. We have also listed our favorite plugins.
This blog post covers:
- Available RabbitMQ plugins
- How to enable RabbitMQ plugins
- CloudAMQP Team Picks
- Security plugins for RabbitMQ
Which RabbitMQ plugins are available?
RabbitMQ plugins cover gaps between standard features and the needs of your organization. Extensions allow for:
- Creating replica brokers via federation or shoveling
- Automatic partitioning of queues via sharding
- Sharing information over the web
- Authenticating users
- Controlling message publication
Plugins may be officially supported or a part of the broader community. RabbitMQ maintains a list of community-maintained plugins.
Discovering Official RabbitMQ PluginsUse the rabbitmq-plugins list command to discover official RabbitMQ plugins. This feature works much like the package search tool in most Linux operating systems. It will only list officially supported plugins and those already added to the plugins folder.
$ rabbitmq-plugins list
It is possible to limit results by appending a regular expression such as management* to the end of the command. As shown in the figure above, where the command rabbitmq-plugins list management* is used. Here we can also see that the rabbitmq_management, rabbitmq_management_agent, and rabbitmq_shovel_management plugins are enabled, but not the rabbitmq_federation_management plugin.
How to install RabbitMQ plugins
The rabbitmq-plugins command allows administrators to turn features on and off as needed. Plugins can only be enabled like this if it’s listed in the plugins directory.
Download and copy the plugin to the expected directory if it is not
officially supported. Then run rabbitmq-plugins enable
$ sudo rabbitmq-plugins enable rabbitmq_management Enabling plugins on node rabbit@host: rabbitmq_management The following plugins have been configured: rabbitmq_consistent_hash_exchange rabbitmq_event_exchange rabbitmq_federation rabbitmq_management rabbitmq_management_agent rabbitmq_shovel rabbitmq_web_dispatch
Enabling RabbitMQ plugins on CloudAMQP
CloudAMQP has simplified every aspect of the enabling/disabling of plugins. The CloudAMQP dashboard lists the most common/used RabbitMQ plugins and can easily be turned on/off in the web browser. When you have created an instance, simply go to the plugins tab in the CloudAMQP dashboard to turn on and off plugins of your choice.
Enabled plugins continue to run until they are disabled, using CPU and memory. We recommend making sure to disable unused plugins. Keep in mind that some plugins may conflict with each other. There are two different x509 authentication plugins for instance. Keeping on top of your plugins helps eliminate conflicts while improving performance.
CloudAMQP Team Picks
RabbitMQ Management Interface
Firstly, we want to highlight the RabbitMQ Management Interface as one of the most important plugins for maneuvering your RabbitMQ instance. This user-friendly interface lets you monitor and handle your RabbitMQ server from a web browser. Queues, connections, channels, exchanges, users, and user permissions can be handled - created, deleted, and listed in the browser. Read about all the perks of the Management interface here.
Even though the Shovel and Federation plugin are bundled with RabbitMQ, and might be well known to experienced RabbitMQ-ers, we still want to highlight them.
Shovel is a plugin for RabbitMQ that enables you to define replication relationships between brokers. It can, for example, be used to balance the load of a queue or when you need to be able to take messages out of one RabbitMQ broker and insert them into another.
Shovel repeatedly pushes messages from a source to a destination using a configurable number of workers. A backup can take the place of an unreachable broker with minimal loss of data.
The RabbitMQ Federation plugin has several use-cases; collect messages from multiple clusters to a central cluster, distribute the load of one queue to multiple other clusters, and when migrating to another cluster without stopping all producers/consumers while doing so. The Federation plugin pushes messages from remote queues to those on the local node. Read more about the federation plugin in this blogpost.
Message timestamp is a great plugin that adds a timestamp when a message first enters RabbitMQ.
Consistent Hash Exchange
Consistent Hash Exchange is a great plugin that is well described in this video from the 2018 RabbitMQ Summit in London by Jack Vanlightly. The consistent hash exchange plugin allows you to use an exchange to load-balance messages between queues and can be used if you need to get the maximum use of many cores in your cluster. The exchange route messages to all queues bound to it, based on the hash of the routing key.
You can watch the recording explaining Consistent Hash Exchange here.
The Sharding makes it easy to scale messages among queues. It allows the number of messages in your system to grow by distributing a queue among multiple nodes and cores. Sharding is performed by exchanges. Exchanges can be defined as sharded and then the routing keys ensure an even distribution of messages among queues. The plugin hashes the incoming routing key sent to a new x-modulus-hash exchange. A modulus function applied to the resulting hash determines which shard receives the incoming message.
A queue is spread among multiple actual queues. The plugin expects you to run a consumer per shard with new nodes being automatically incorporated. Note that it’s important to consume from all queues.
Image description: Sharding takes place in the exchange. Messages sent from a producer are, via the exchange and the routing key, distributed equally among queues in other nodes. The messages are then handled by separate consumers.
Priority Queues is a plugin useful for exactly what it sounds like: setting different priorities and letting messages be handled by its importance. This plugin is beneficial in various ways and you can read about them in this blogpost about Priority Queues.
Delayed Message Exchange
We would also like to highlight the “Delayed Message Exchange” plugin, even though it should be used carefully. The plugin supports messages to be delayed for a specified amount of time and can be really beneficial as long as you don’t store too many messages. You can read more about Delayed Message Exchange here.
Security plugins for RabbitMQ
Security is a growing concern. RabbitMQ allows administrators to limit users to specific virtual (since RabbitMQ version 3.8) hosts with authentication over three different SASL mechanisms. Unfortunately, most authentication mechanisms involve passing plain text passwords and usernames.
Plugins add support for non-plaintext authentication. The x509 certificate plugin allows users to connect to the broker using a unique client certificate containing their username. The rabbitmq_auth_backend_ip_range community plugin allows administrators to limit login attempts to a set of specific IP addresses.
Support for other messaging protocols
RabbitMQ default protocol is AMQP, but it is a message broker that allows clients to connect over a range of different open and standardized protocols. It’s possible to add support for protocols like AMQP, HTTP, STOMP, MQTT and WebSockets/Web-Stomp.
We hope you like this blog post. Please comment below if you have any questions or concerns regarding RabbitMQ plugins, and if you wish us to enable a plugin that needs additional configuration, send an email to email@example.com
All the best, The CloudAMQP team