thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
221 stars 54 forks source link

tedge-mapper must send the init messages to cloud only after checking the bridge status #2070

Closed PradeepKiruvale closed 8 months ago

PradeepKiruvale commented 1 year ago

Is your feature improvement request related to a problem? Please describe. The tedge-mapper-c8y sends the init messages to the Cumulocity cloud when it starts for the first time These messages like inventory_fragments_message, supported_operations_message, device_data_message, pending_operations_message, cloud_child_devices_message.

The mapper depends on the mqtt bridge to communicate with the cumulocity cloud. In the current implementation, these messages are sent without checking the bridge status., whether the bridge is established or not. So, if the bridge is not established the messages will be lost. This will have a bad experience for the further operation of thin-edge.io.

Describe the solution you'd like The proposed solution is first to check that the bridge is established or not before sending out the init messages that are mentioned above. If the bridge is not established, then the mapper must defer and wait till the bridge gets established. Mapper can subscribe to tedge/health/mosquitto-c8y-bridge topic to check the health status of the bridge. The init message can be sent either the status of the bridge is up/down. That means the bridge must be established, if its not up at present then the Mosquitto broker can buffer those messages and can deliver once it comes up.

Describe alternatives you've considered

Additional context This will be helpful when the thin-edge components run on different containers. For example tedge-mapper running on an independent container than the mosquitto broker in another then will be more useful.

reubenmiller commented 8 months ago

@albinsuresh is this now covered after merging https://github.com/thin-edge/thin-edge.io/pull/2695

albinsuresh commented 8 months ago

Yes, it is already addressed in #2695. Closing the issue.