Diffusion Now Supports MQTT
December 10, 2020 | Philip Aston
Support for the OASIS MQTT open standard protocol is the main feature added to Diffusion 6.6 Preview 2, the latest release of the Diffusion® Intelligent Event Data Platform.
MQTT is a publish-subscribe messaging protocol commonly used to connect Internet of Things (IoT) applications. A wide range of IoT devices can now connect directly to Diffusion, send and receive data, interact with other Diffusion clients, and benefit from Diffusion’s event data processing features and rich security framework. MQTT can also be used as a lightweight alternative to the Diffusion SDK for simple publish-subscribe use cases. The Diffusion SDK is required if you want to do anything other than publish and subscribe to topics, including adding and removing topics, using the request-response messaging API, performing range queries against time series topics, or server administration.
Diffusion implements MQTT 5.0, the latest version of the specification. Both the TCP and WebSocket transports are supported, and connections can be secured using Transport Layer Security (TLS). Diffusion treats MQTT as a first class protocol, and acts as a session broker for MQTT clients in the same way as it does for Diffusion SDK clients. Each server can host tens of thousands of MQTT sessions; and servers can be configured in clusters to scale to an arbitrarily large number of connections. MQTT clients can be monitored and managed by Diffusion SDK clients, the management console, and external tools connected via the Prometheus or JMX gateways.
The MQTT support is fully integrated with Diffusion’s security framework: MQTT connections are authenticated just like any other connection, and publish and subscribe operations are subject to the server’s configured access control rules.
We’ve not set out to make Diffusion a general MQTT broker. Indeed, there are few places where we deliberately chose not to comply with the specification to provide MQTT clients better access to Diffusion’s capabilities. When a publish packet is received from an MQTT client, it is applied as an update to a Diffusion topic. We’ve defined straightforward mappings between MQTT payloads and topic data. Subscribers subscribe to Diffusion topics. In contrast, MQTT brokers are more message-oriented, passing received packets directly to subscribers with minimal added value. Through this tighter integration, MQTT clients have full access to Diffusion’s data wrangling capabilities and can exchange data with other types of Diffusion client.
This is our first release of MQTT support. We will shortly be making it available to Diffusion Cloud users as well. We’re considering implementing older versions of the specification (in particular, 3.1.1), and extensions such as allowing user properties to be passed through, and interoperation with Diffusion request-response messaging. If you have particular MQTT requirements, reach out and let us know.