Replace your MQTT broker with NATS Server

Ivan Kozlovic — May 20, 2021

Replace your MQTT broker with NATS Server v2.2.0+

NATS Server v2.2.0+ has native support for MQTT v3.1.1 protocol.

If you already have a deployment with existing MQTT broker(s) and use NATS messaging, or are planning to, this blog post will show you how easy it is to replace your existing MQTT broker with a NATS server.

Not only you would have to manage a single server instead of two, using NATS with MQTT will allow you to exchange data from MQTT to NATS and vice-versa.

In this repository you will find detailed instructions and all required scripts to run the demonstration.

  • The first stage is to run a simulator that generates MQTT messages and a MQTT subscription to consume them.
  • Then, in the second stage , we replace the MQTT broker with NATS and see how messages can be exchanged between MQTT and NATS.
  • Finally, in the third stage we run a NATS server with a Leafnode connection to Synadia’s NGS super cluster and show how MQTT messages can be received with NATS from anywhere in the world.

You can watch all that in the following video. Enjoy!

About the Author

Ivan Kozlovic is a senior member of the engineering team at Synadia Communications .

Questions? Join our Slack channel or email info@nats.io .


Back to Blog