MQTT Plugin
Overview
RabbitMQ supports MQTT versions 3.1, 3.1.1, and 5.0 via a plugin that ships in the core distribution.
This guide covers the following topics:
- How to enable the plugin
- Supported MQTT features and limitations
- MQTT plugin implementation overview
- When (not) to use quorum queues
- MQTT QoS 0 queue type
- Users and authentication and remote connections
- Key configurable settings of the plugin
- TLS support
- Virtual hosts
- Metrics
- Performance and scalability check list
- Proxy protocol
- Sparkplug support
Enabling the Plugin
The MQTT plugin is included in the RabbitMQ distribution. Before clients can successfully connect, it must be enabled on all cluster nodes using rabbitmq-plugins:
rabbitmq-plugins enable rabbitmq_mqtt
Supported MQTT features
RabbitMQ supports most MQTT 5.0 features including the following:
- QoS 0 (at most once) and QoS 1 (at least once) publish & subscribe
- TLS, OAuth 2.0
- Clean and non-clean sessions
- Message Expiry Interval
- Subscription Identifier and Subscription Options
- Will messages including Will Delay Interval
- Request / Response including interoperability with other protocols such as AMQP 0.9.1 and AMQP 1.0
- Topic Alias
- Retained messages with the limitations described in section Retained Messages and Stores
- MQTT over a WebSocket via the RabbitMQ Web MQTT Plugin
The MQTT 5.0 blog post provides a complete list of supported MQTT 5.0 features including their usage and implementation details.
MQTT clients can interoperate with other protocols.
For example, MQTT publishers can send messages to AMQP 0.9.1 or AMQP 1.0 consumers if these consumers consume from a queue
that is bound to the MQTT topic exchange (configured via mqtt.exchange
and defaulting to amq.topic
).
Likewise an AMQP 0.9.1, AMQP 1.0, or STOMP publisher can send messages to an MQTT subscriber if the publisher publishes to the MQTT topic exchange.
How the MQTT plugin works
RabbitMQ MQTT plugin targets MQTT 3.1, 3.1.1, and 5.0 supporting a broad range of MQTT clients. It also makes it possible for MQTT clients to interoperate with AMQP 0-9-1, AMQP 1.0, and STOMP clients. There is also support for multi-tenancy.