java: add MQTT auto reconnect to IoT3 Core#325
java: add MQTT auto reconnect to IoT3 Core#325mathieu1fb merged 5 commits intoOrange-OpenSource:masterfrom
Conversation
The IoT3Core MQTT client will try to reconnect automatically upon connection loss, avoiding the need to handle reconnection at a higher level. Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
…MQTT client The IoT3Core MQTT client will try to reconnect with an initial delay of 500 ms, up to 5 s maximum. The default values were respectively 1 s and up to 2 minutes, which is not aggressive enough for our needs. Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
…IoT3Core isMqttConnected() result Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
…o connection status CAM and CPM: only publish if the client is connected DENM: publish even when the client is disconnected, so the messages are queued and sent upon reconnection Signed-off-by: Mathieu LEFEBVRE <mathieu1.lefebvre@orange.com>
|
I confirmed that reconnection ik OK: `Bootstrap success mars 17, 2025 9:26:59 AM com.orange.iot3core.clients.MqttClient publishMessage //First message with no corresponding reception. //Mqtt related infos. //Mqtt reconnection //Messages are received. |
Feature
The IoT3 Core MQTT client now has an automatic reconnection policy: reconnection will automatically be tried 500 ms after a connection loss the retry delay will gradually increase up to every 5 seconds.
The IoT3 Core and Mobility also expose respectively an isMqttConnected() and isConnected() method.
Closes #323
How to test
Iot3MobilityBootstrapExampleclass in theexamplesmodule, and set appropriate values for the following fields:Iot3MobilityBootstrapExample.Expected results: