In a nutshell …
MQTT (Message Queue Telemetry Transport) was originally developed by IBM and its partners from the industrial sector (Dr Andy Stanford-Clark of IBM, and Arlen Nipper of Eurotech, in 1999). Since, the protocol has been opened to open source community and has significant growth in popularity, as mobile applications have taken off (version 3.1 of the protocol has been posted in 2010). Now there is a will of making a standard : http://mqtt.org/2013/02/mqtt-proposed-as-an-oasis-standard
The aims of MQTT are focused on providing publish/subscribe messaging system and was specifically designed for constrained environment and devices (low resources, low bandwidth, high latency or weak networks, satellite links … ). More precisely, one of the main target is to be used in embedded systems, connecting “smart” things to the IT world.
The interesting aspects of this protocol :
- Simple API : connect, publish, (un)subscribe, disconnect
- pub/sub and push approach
- Compact binary packet payload (much less verbose than text-based protocol like HTTP) – Smallest possible packet size is 2 bytes
- Quality Of Service
- support for loss of contact between client and server (“Last will” feature, to publish a message if the client goes offline)
- Handle “durable” subscriptions
- Agnostic : simple binary payload (no special data format needed)
The QOS management offers three qualities of service:
- QOS 0 : “fire and-forget”. Message is simply send. No care if it has been received.
- QOS 1 : “at least once”. Ensure to be sent a minimum of one time (but might be sent more than one time)
- QOS 2 : “exactly once”. Multi deterministic message delivery to reflect tradeoffs between bandwidth, availability, and delivery guarantees.
Actual open source landscape
Publishing the protocol to the open source world is a good step to help adoption by device vendors, software makers and helps widely to extend its support. This clearly helps bringing new platforms, technologies and networks that are driven by different problematics (cost, used technology and physical constraints).
Number of open source libraries & platforms are available. I have played with some of them, through Spring Amqp Integration :
- Mosquitto : reference broker implementation with very small footprint (embeddable on small devices) http://mosquitto.org/
- Paho : Eclipse M2M framework initiative. Good reference java client library (http://www.eclipse.org/paho/)
- Rabbitmq : has integrated mqtt with connector/plugin. Simply works on most features (http://www.rabbitmq.com/blog/2012/09/12/mqtt-adapter/)
- Apache apollo : broker extracted from activemq. Still in early stage development (http://activemq.apache.org/apollo/)
I have noticed that the maven artefacts for eclipse paho are not rightly pushed to the maven central repository. For my tests, I have used “mqtt-client” artefact from http://repo.springsource.org/libs-milestone/ repository.
Already in your every day’s life ?
IoT scenarios such as sensors/temperature updates, or any smart devices notifications can be efficiently developed with this kind of push protocol. An ordinary M2M scenario consists in simply connect an Arduino device to a web service with MQTT. (Don’t know if Sigfox is using this protocol for their solutions)
Why another MQ protocol ? Instead of enterprise messaging brokers, MQTT is intentionally oriented for low footprint usages, making it a great solution for today’s mobile and developing “Internet of Things” applications. Companies like Facebook are already using it in their mobile applications, because of its low power and network bandwidth usage . (http://mqtt.org/2011/08/mqtt-used-by-facebook-messenger)
Here is a power profiling test : HTTPS Long Polling vs. MQTT with SSL, on Android : (http://stephendnicholas.com/archives/1217)
Cloud infrastructure is in the party too. It’s now very easy to deploy a broker in the cloud, making it quickly available for your devices fleet. Even if deploying a broker on a cloud platform like Amazon Ec2 is affordable, company like M2M.io (http://m2m.io/) try to help bringing easily your devices online (we haven’t tested this solution yet).
A last word for another kind of industrial Mqtt usage : critical network architectures. In Toulouse, we are aware of critical network communications like onboard aircraft communication with ground servers. These kind of scenarios are not always easy. An architecture based on Mqtt could have its place in this kind of environment.Google+