How to use exponential back-off logic in Azure device client?

DEEPAK KUMPALA 191 Reputation points
2022-09-15T07:05:24.097+00:00

I have a job in C# which runs every 5 minutes and acts like a heartbeat to check the client status

When the status is Disconnected_Retrying, I exit the timer job assuming retry will work. However, status always comes as Disconnected_Retrying and leads to unnecessary calls/request to server every 5 minute. Hence I am thinking of implementing exponential backoff method to overcome this issue

Started reading below GitHib code https://github.com/Azure/azure-iot-sdk-csharp/blob/main/iothub/device/src/RetryPolicies/ExponentialBackoff.cs

But I am not able to understand how to implement it.

Note: I have created same question in stack overflow for better reach

Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
222 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,995 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.