iotedge-lorawan-starterkit icon indicating copy to clipboard operation
iotedge-lorawan-starterkit copied to clipboard

DeviceClient re-connection handling

Open p-schuler opened this issue 3 years ago • 2 comments

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 avatar Jan 25 '22 15:01 p-schuler

@p-schuler should we close this? Or is this more related to monitoring the connection status changes?

danigian avatar Mar 07 '22 07:03 danigian

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

p-schuler avatar Mar 07 '22 08:03 p-schuler