N
N
Nastya19202021-01-16 21:41:47
Spring
Nastya1920, 2021-01-16 21:41:47

How to subscribe a device instance to update its telemetry data?

I need help with the idea of ​​iot telemetry data architecture (I don’t know how it’s done in real life, and I’m afraid to fantasize a lot):
In the spring boot application, I have to create a new device (from a template, for example). In essence, there is an array of telemetry data objects: you need to receive relevant data from the sensor and constantly update this field from the device saved in the database.

Sketch:
1. I create a device (there is a sample of the device type, for example)
2. I set it to "enabled ON" and "subscribed TRUE"
3. I save it to the database.
4. I make a trigger for some job so that it goes and adds a Kafka topic to this device for recording (is it possible to do this and how to do it is a question)
5. Next, Kafka reads all messages from the general topic in batches (payload for each: device_id, data) and updates the entity in the database for each of the received device_id.
6. If the client presses "disable the device", then I make it enabled - off, subscribed - false in the database and run a job that will cancel the sensor's entry into the general Kafka topic (how to programmatically turn off the sensor in real life - I can't find it anywhere)

Sorry for the stream of consciousness, but I have no experience with such systems, I improvise. I would be very grateful for your advice

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question