MQTT and Kafka are two popular technologies in the industry. These are two of the inevitable components in any IoT platforms. I have developed IoT and IIoT solutions for several customers worldwide. I cannot even think of a solution without these components.

MQTT is light weight and it is very easy for low footprint devices to interact. So it is the best suitable framework to collect data from light weight low footprint sensors and data acquisition software.

Kafka is robust, distributed and can handle heavy load. It is a distributed queue. It can handle any flood seamlessly. It has data retention capability and it is replicated and highly scalable. So the best place to hold the data before the processing layer is Kafka.

So we need an interface between MQTT and Kafka in a lot of use cases. The interface or the bridge between MQTT and Kafka needs to be scalable and fast enough to push all the data from the MQTT Topic/(s) to the corresponding topic in Kafka.

I have developed a simple MQTT to Kafka bridge program which can be easily deployed using a docker container. In this way, you don’t need to spend time in developing this from scratch. The complete code and the instructions are present in the following github repository.

https://github.com/amalgjose/mqtt-kafka-bridge.git

raw.githubusercontent.com/amalgjose/mqtt-kafka-bridge/refs/heads/main/index.js

Please let me know if you are facing issues while using this. Also feel free to comment your feedback and suggestions.