What is MQTT?
MQTT stands for Message Queue Telemetry Transport. MQTT is a publish/subscribe messaging protocol invented by Dr Andy Stanford-Clark of IBM and Arlen Nipper of Arcom (now known as Eurotech), in 1999.
MQTT is an extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks.
What is messaging protocol?
In JMS, there are basically two type of messaging protocol
- Point-to-Point (PTP)
- Publish/Subscribe (pub/sub)
1) Point-to-Point (PTP) Messaging protocol
Point-to-Point messaging protocol use queue as messaging domain. In this protocol user can send and receive messages from the queue synchronously or asynchronously. Each message received on queue is delivered to the specific user once and only one.
So, this protocol is similar to if any one sends email to you then only you can able to receive the message.
2) Publish/Subscribe Messaging protocol
Publish/Subscribe messaging protocol uses topic as messaging domain. Publish/subscribe messaging protocol is something like; you are registered for some email service to get emails when the topics are published. So, when any topic gets published on it, then the entire subscribers receive one copy of the message.
MQTT supports only publish/subscribe type messaging protocol.
1. MQTT Publisher
To publish the message using the MQTT protocol you need to define the MQTT publisher, using that you can send message to the messages to the topic.
The code snippet in next page will help you to create your own receiver and publisher to work with different MQTT Broker provider like (Apache Active MQ, Mosquitto, etc.).