-
Notifications
You must be signed in to change notification settings - Fork 72
refactor mqtt_service feature to utilize the mqtt service SmartREST proxy #3858
Description
Is your refactoring request related to a problem? Please describe.
Refactor the mqtt_service feature with the Cumulocity MQTT Service which should support a single MQTT connection for both SmartREST messages and free-form topics.
Describe the solution you'd like
Below describes the 4 items to refactor the current implementation of the mqtt_service integration in thin-edge.io. The key to the changes is to more think of the mqtt-service as an extension to the existing bridge, rather than a new type of bridge.
### Item 1: Remove username handling
The MQTT Service no longer requires setting the tenant id in the username. As the new MQTT Service now supports connecting to it exactly the same as the Core MQTT (except for the fact that it uses port 9883 instead of 8883).
Item 2: Remove the c8y.mqtt_service.url and c8y.mqtt_service.topic_prefix settings
Since the Cumulocity MQTT service will be supporting the SmartREST proxy, there is no longer a need for a dedicated url just for the Cumulocity MQTT service, as the native c8y.url or (c8y.http and c8y.mqtt) values can be set.
The c8y.mqtt_service.topic_prefix setting is also no longer needed as both the SmartREST topics and free-form topics will be under the mapper's prefix, e.g. c8y/.
Item 3: Remove default values for c8y.mqtt_service.topics
Remove the default values in the c8y.mqtt_service.topics settings so it does not create unnecessary subscriptions for the users.
Item 4: Refactor behaviour of the c8y.mqtt_service.enabled setting
When c8y.mqtt_service.enabled is set to true the following should happen:
-
the default mqtt port should change from
8883to9883 -
the topics defined in
c8y.mqtt_service.topicsshould be added to the bridge's subscribed topics (to the cloud)remote: foo/bar local: c8y/mqtt/in/foo/bar
-
the bridge should create an outbound rule to map any topic under a given root topic to the mqtt service
c8y/mqtt/out/#Where a message published
local: c8y/mqtt/out/foo/bar remote: foo/bar
Describe alternatives you've considered
Additional context