thin-edge.io icon indicating copy to clipboard operation
thin-edge.io copied to clipboard

Guideline for tedge MQTT topic schemes to accommodate child devices

Open albinsuresh opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

With the introduction of child devices, the existing MQTT topics like tedge/measurements, tedge/alarms/<severity>/<alarm-type> were updated to include the child-id as follows: tedge/measurements/<child-id>, tedge/alarms/<severity>/<alarm-type>/<child-id>.

But, this updated topic scheme for child devices is not easy manage when a user wants to do some simple queries like "subscribe to all the data sent and received by a child device". With the current topic scheme, the user will have to know all the topics supported for child devices and then selectively subscribe to all of them individually. A more natural way to express such a query would be something like tedge/<child-id>/#. But, keeping the child-id at this position in the topic scheme affects such wildcard subscriptions for the thin-edge device.

So, provide a topic scheme that primarily meets the following requirements, preferably without breaking backward compatibility:

  • Subscribe to incoming/outgoing messages from the thin-edge device excluding any messages meant for child devices
  • Subscribe to all messages of thin-edge device as well as child devices
  • For a given child device, subscribe to all the messages meant for it, excluding the messages for other child devices as well as the ones of the thin-edge device itself.

A few other points to consider while making a complete overhaul:

  • Currently, sending some data to tedge/ topics like tedge/measurements imply that the message will get forwarded to the cloud as well. For edge processing, it's essential to support a mechanism where data can be sent to thin-edge, without forwarding them to cloud. A topic scheme for such interactions will also be required.

Describe the solution you'd like

A topic prefix like tedge/main/# for thin-edge device and tedge/<child-id>/# for child devices. But this new scheme for the thin-edge device affects backward compatibility.

Describe alternatives you've considered

Keep the existing tedge/# topic scheme for the thin-edge device and introduce a new topic prefix like tedge-child/<child-id>/# for child devices. For all the messaging limited to thin-edge, we could even introduce a new scheme like tedge-internal/# in future.

albinsuresh avatar Aug 19 '22 07:08 albinsuresh