Cumulocity IoT operations created whilst the bridge is done are not processed upon reconnection
Describe the bug
Cumulocity IoT operations which are created whilst the Cumulocity IoT MQTT bridge is disconnected do not get processed by the tedge-mapper-c8y when the network outage has passed (e.g. the bridge can communicate with Cumulocity IoT again).
The operations are left in the PENDING state until the mapper is either restarted, or a manual SmartREST 2.0 500 static SmartREST 2.0 message is published (once the mapper health status returns).
Workaround
The following MQTT message can be published locally to request the PENDING operations from Cumulocity IoT once the cloud connectivity has been restored:
tedge mqtt pub c8y/s/us 500
To Reproduce
-
Install and configuration thin-edge.io and verify the bridge connection to Cumulocity IoT is up/healthy
-
Disconnect the network
-
Wait until the bridge is down
-
Create a new operation in Cumulocity IoT. For example request a the
tedge-configuration-plugin -
Connect the network
-
Wait until the bridge has been re-established
-
Expectation: The pending operation should be processed by thin-edge.io, and set to
SUCCESSFUL
Expected behavior
Any operations which are created whilst the Cumulocity IoT bridge is down, should be processed one the connectivity has been reestablished.
The way this should be done, is that the static SmartREST 2.0 template, 500 should be sent when the connection has been restored.
Screenshots
Environment (please complete the following information):
- OS [incl. version]:
any - Hardware [incl. revision]:
any - System-Architecture [e.g. result of "uname -a"]:
any - thin-edge.io version [e.g. 0.1.0]:
1.3.1
Additional context
A system test case has been added to cover the bug found here. https://github.com/thin-edge/thin-edge.io/pull/3170
I've tested this fix (included part of https://github.com/thin-edge/thin-edge.io/pull/3278), and it works as intended, but there is a following up issue where the devicecontrol/operations message payload can included multiple operations (newline delimited), which causes the parsing to fail. So technically this ticket can be closed, and the limitation on parsing the multiple operations in one message from the cloud is tracked in this ticket: https://github.com/thin-edge/thin-edge.io/issues/3297