DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Data Engineering
  3. IoT
  4. Designing MQTT Over AMQP

Designing MQTT Over AMQP

MQTT is a handy IoT protocol, but its design has some weaknesses, such as a lack of flow control or metadata options. Putting AMQP over it can solve those problems.

Paolo Patierno user avatar by
Paolo Patierno
·
Jan. 05, 17 · News
Like (8)
Save
Tweet
Share
13.31K Views

Join the DZone community and get the full member experience.

Join For Free

mqtt_over_amqp

Let’s think about what we can consider some weaknesses of the MQTT protocol.

  • It provides native publish/subscribe pattern only; Using request/reply is quite cumbersome with “correlation injection” inside topics and payload messages.
  • It doesn’t provide flow control.
  • It doesn’t have metadata information inside messages (i.e. content type).
  • It’s fully broker-centric.

But there are some unique features that we have to consider as strengths for this protocol as well.

  • Retained messages (also known as “last well known” messages).
  • Last will and testament (LWT).
  • Session handling.

Now, let’s think about the main features that fill the gap for the MQTT protocol provided by AMQP:

  • Native support for both publish/subscribe and request/reply patterns (correlation for free).
  • Flow control at different levels (with max window size and message credits).
  • A full type system and metadata information on each message.
  • Peer-to-peer model (the broker is just a peer).

But it lacks those key MQTT features! So, how much greater could be AMQP be if it had them?

Under the open source EnMasse project, I have been working on a design (so a kind of “specification”) for having retained messages, last will and testament, and session handling over AMQP. At the same time, I have been developing an MQTT “gateway” in order to allow remote MQTT clients to connect to an AMQP-based “Message as a Service” like EnMasse.

Having such a design means that not only can an MQTT client leverage retained messages after subscribing to a topic, sending its LWT over the connection or receiving messages for a topic when it was offline; it means having the above features for native AMQP clients as well.

Each feature is made by a well-defined AMQP message using specific subjects, annotations, and payloads in order to bring all MQTT-related information, like retained flags, will QoSes, will topics, and so on, but using AMQP semantics.

This sort of “specification” doesn’t force to use a specific implementation; the EnMasse project leverages on the Qpid Dispatch Router for connections and Apache Artemis brokers where a state is needed (but other implementations could use something different, like a simple file system or a database). Of course, some additional services are needed in order to handle LWTs and subscriptions (we just called them “Will Service” and “Subscription Service”).

If you are so curious and want to give some feedback , you can find all the open source stuff on GitHub in the MQTT over AMQP documentation section.

MQTT

Published at DZone with permission of Paolo Patierno, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • HTTP vs Messaging for Microservices Communications
  • Custom Validators in Quarkus
  • How To Choose the Right Streaming Database
  • DevOps for Developers: Continuous Integration, GitHub Actions, and Sonar Cloud

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: