Class NoRetryPolicy
- Namespace
- Azure.Iot.Operations.Protocol.Retry
- Assembly
- Azure.Iot.Operations.Protocol.dll
A retry policy that will never retry.
public class NoRetryPolicy : IRetryPolicy
- Inheritance
-
NoRetryPolicy
- Implements
- Inherited Members
Constructors
NoRetryPolicy()
Creates a retry policy that will never retry.
public NoRetryPolicy()
Methods
ShouldRetry(uint, Exception?, out TimeSpan)
Method called by the client when an operation fails to determine if a retry should be attempted, and how long to wait until retrying the operation.
public bool ShouldRetry(uint currentRetryCount, Exception? lastException, out TimeSpan retryDelay)
Parameters
currentRetryCount
uintThe number of times the current operation has been attempted.
lastException
ExceptionThe exception that prompted this retry policy check.
retryDelay
TimeSpanSet this to the desired time to delay before the next attempt.
Returns
- bool
True if the operation should be retried; otherwise false.
Examples
class CustomRetryPolicy : IRetryPolicy
{
public bool ShouldRetry(uint currentRetryCount, Exception lastException, out TimeSpan retryDelay)
{
// Add custom logic as needed upon determining if it should retry and set the retryDelay out parameter
}
}