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

Tedge services to support custom mqtt topic scheme

Open albinsuresh opened this issue 1 year ago • 0 comments

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

Even though tedge config allows you to change the device topic id using the mqtt.device_topic_id config setting, the value is expected to follow the default topic scheme itself in the device/<entity-id> format.

When a custom topic scheme is used as follows:

tedge config set mqtt.device_topic_id custom/device//

the mapper refuses to start with the following error message:

Feb 16 08:40:37 9be5165914a8 tedge-mapper[5172]: Error: Can't derive service name if device topic id not in default scheme
Feb 16 10:35:54 9be5165914a8 systemd[1]: tedge-mapper.service: Main process exited, code=exited, status=1/FAILURE

... and the agent also fails with a similar message:

Feb 16 10:35:54 9be5165914a8 tedge-agent[5354]: Error: Device topic id custom/device// currently needs default scheme, e.g: 'device/DEVICE_NAME//'
Feb 16 10:35:54 9be5165914a8 systemd[1]: tedge-agent.service: Main process exited, code=exited, status=1/FAILURE

Describe the solution you'd like

Allow custom topic schemes to be used in the device topic id and make sure that all services like tedge-agent, mappers and even the mqtt bridge honours that topic id.   Additional context

Updating the topic id after using the default topic scheme for a while would not be trivial as all the retained metadata messages published to the older topic id will have to be removed/reconciled. So, the scope of this ticket can be limited to just setting a different topic scheme before any bootstrapping. Updating an already used topic scheme can be addressed in a different ticket.

albinsuresh avatar Feb 16 '24 10:02 albinsuresh