'Websocket from Kafka messages
I am working on an IoT project that uses MQTT protocol to transport the sensor data from embedded devices to an App. For this i have created,
- A MQTT broker to send the data from the device.
- A custom bridge that push data from MQTT broker to my Kafka broker
- Django server to push the messages via websocket to the App
Right now, What i need is to consume the Kafka messages from django, save to the DB and then push this data to client via websockets. But i don't have much idea regarding how to consume Kafka messages from Django. So far the solution in my mind is using custom management command, start a kafka consumer, push the data to DB and then to websockets.
Is this a good approach? If not, what would be a good solution to solve this?
Solution 1:[1]
You can add periodic task to consume a topic and bulk insert (or update) to database (it impact on the performance).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mohammad sadegh borouny |
