Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MQTT broker + mongoDB

Tags:

mongodb

mqtt

How do i integrate MQTT broker with mongoDB ?

I publish gps co ordinates from a client to the broker and would like to store that in MQTT broker with mongoDB,

Would appreciate if some pointers are shared for the same

like image 477
user3690081 Avatar asked Jan 11 '23 11:01

user3690081


2 Answers

If you want your broker to directly store the message reliably to the database, you could use HiveMQ and write a MongoDB plugin. The concept is described in this blog post.

Another idea would be to use a wildcard subscriber which gets all messages and stores that to MongoDB. That wouldn't be a direct integration but would work if you don't want to scale out.

like image 94
Dominik Obermaier Avatar answered Jan 19 '23 05:01

Dominik Obermaier


I searched around and didn't find any suitable solution for myself so I created one: https://github.com/izmailoff/mqtt-mongo.

See the README for all details. Essentially it's a standalone service that connects to MQTT broker and MongoDB and subscribes to the topics you are interested in. You can select a collection for each topic in the config.

The design goals are to have resilient, lightweight and fast service which you can also customize with code in Java/Scala or any JVM language that supports such integration.

like image 27
yǝsʞǝla Avatar answered Jan 19 '23 06:01

yǝsʞǝla