Contact Us
SaaS Log InXRay Login
RabbitMQ

MQTT vs RabbitMQ (AMQP 0.9.1) for IoT

Nastel Technologies®
July 1, 2022

MQTT vs RabbitMQ: Understanding the Differences

 

RabbitMQ is an open source server that was created to support the AMQP 0.9.1 messaging protocol. It now supports other protocols as well, including MQTT 3.1.1, but AMQP 0.9.1 is its core method. So here we will compare AMQP 0.9.1 with MQTT.

 

MQTT was designed for the Internet of Things (although it wasn’t called that at the time). Both MQTT and AMQP run over TCP connections, both are client-server in architecture and bi-directional.

 

AMQP was designed to provide general purpose high performance enterprise messaging, whereas MQTT was created as an IoT protocol. AMQP has many features to cater for a range of messaging scenarios and is more complex than MQTT. The core AMQP destinations for messages are queues, but there are several different methods of routing messages. MQTT has just one routing mechanism – topic subscriptions.

 

What is MQTT?

 

MQTT is a communication protocol with features specifically targeted at IoT solutions:

  • Uses TCP connections, for reliability (assured delivery and packet error checking), fragmentation and ordering.
  • Aims to minimize data overhead of each MQTT packet.
  • The last known good data value for a device can be stored (retained messages).
  • Notifications when client unexpectedly disconnects (will message) to allow client state to be monitored.
  • Bi-directional message flow – data from and commands to devices can use the same TCP connection.
  • Publish subscribe routing, which allows the easy addition of more consumers and producers of data.
MQTT Publish/Subscribe Pattern

 

The MQTT commands are CONNECT, SUBSCRIBE, PUBLISH, UNSUBSCRIBE and DISCONNECT. MQTT Topics are the unit of distribution, to which clients can PUBLISH and SUBSCRIBE. All authorized subscribers to a topic will receive all messages published to it. MQTT topics do not have to be predefined: applications can create them simply by using them.

 

What is AMQP?

AMQP is a messaging protocol which was created to be a non-proprietary method of connecting applications. AMQP 0.9.1 is a product of the AMQP working group, whereas AMQP 1.0 is an OASIS standard, as are MQTT 3.1.1 and 5.0. AMQP 1.0 is quite a different protocol from 0.9.1, which complicates AMQP support. AMQP supports multiple routing topologies, which are mainly application-defined. This gives flexibility at some cost of application setup. Here is an example routing showing the fundamental components:

AMQP fundamental components

AMQP fundamental components

An application has to create a queue if it doesn’t already exist, and then bind that queue to an exchange. The exchange is the target of the message publish operation, which then routes messages to queues. There are four predefined exchange types:

  • Direct – routing key matches queue name
  • Fanout – every queue bound to it receives every message
  • Topic – messages are routed to queues based on the pattern used when binding the queue to the exchange
  • Headers – similar to the topic exchange but uses message headers in the matching algorithm

This is an AMQP topology which could approximate an MQTT broker configuration:

AMQP Topology

AMQP Topology

AMQP has features which do not exist in MQTT or only in MQTT 5.0 such as:

  • Message headers (in MQTT 5.0)
  • Multiple lightweight connections over one TCP connection (channels)
  • Virtual hosts (isolated server environments)

 

This article originally appeared on hivemq.com, to read the full article, click here.

Nastel Technologies is the global leader in Integration Infrastructure Management (i2M). It helps companies achieve flawless delivery of digital services powered by integration infrastructure by delivering tools for Middleware Management, Monitoring, Tracking, and Analytics to detect anomalies, accelerate decisions, and enable customers to constantly innovate, to answer business-centric questions, and provide actionable guidance for decision-makers. It is particularly focused on IBM MQ, Apache Kafka, Solace, TIBCO EMS, ACE/IIB and also supports RabbitMQ, ActiveMQ, Blockchain, IOT, DataPower, MFT, IBM Cloud Pak for Integration and many more.

 

The Nastel i2M Platform provides:

Comments

Write a comment
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment * This field is required!
First name * This field is required!
Email * Please, enter valid email address!

Schedule your Meeting

 


Schedule your Meeting


Subscribe

Schedule a Meeting to Learn More