iotedge-lorawan-starterkit
iotedge-lorawan-starterkit copied to clipboard
DeviceClient re-connection handling
DeviceClient
can disconnect for various reasons. A lot of them are recoverable and are managed by the client library, others require additional logic and monitoring to keep the connection working.
Expected Behavior
If there is a DeviceClient registered for a LoRaDevice, it can be used to connect to IoT hub.
Current Behavior
If the DeviceClient connection status becomes unusable, the DeviceClient needs to be re-created to re-establish the connection.
Steps to Reproduce
No easy repro steps. The connection has to get into an unrecoverable state.
The table contains states we should handle and act on.
https://github.com/Azure-Samples/azure-iot-samples-csharp/tree/main/iot-hub/Samples/device/DeviceReconnectionSample
@p-schuler should we close this? Or is this more related to monitoring the connection status changes?
This is to react on disconnects proactively and re-create the instance if needed. The exception handling we added is still required, but this could help avoiding the exceptions in most of the cases. @danigian