Table of Contents

Class RetryPolicy

Namespace
Microsoft.ServiceBus
Assembly
Microsoft.ServiceBus.dll

Represents an abstraction for retrying messaging operations. Users should not implement this class, and instead should use one of the provided implementations.

public abstract class RetryPolicy
Inheritance
RetryPolicy
Derived
Inherited Members

Properties

Default

Gets an instance of the RetryExponential retry policy, which provides a default setup of exponentially increasing retry intervals for messaging operations. Each time this property is accessed, a new instance is created.

public static RetryPolicy Default { get; }

Property Value

RetryPolicy

The default policy associated with the policy.

NoRetry

Gets an instance of the NoRetry retry policy, which effectively disables retries. Each time this property is accessed, a new instance is returned.

public static RetryPolicy NoRetry { get; }

Property Value

RetryPolicy

A retry policy that performs no retries.

Methods

Clone()

Creates a new copy of the current RetryPolicy and clones it into a new instance.

public abstract RetryPolicy Clone()

Returns

RetryPolicy

A new copy of RetryPolicy.

IsRetryableException(Exception)

Determines whether it is permissible to retry after the specified exception.

protected abstract bool IsRetryableException(Exception lastException)

Parameters

lastException Exception

The latest occurred exception.

Returns

bool

If this method returns false, no retry occurs. Otherwise, the OnShouldRetry(TimeSpan, int, out TimeSpan) method determines when to retry.

OnShouldRetry(TimeSpan, int, out TimeSpan)

Calculates the retry interval for the retry policy.

protected abstract bool OnShouldRetry(TimeSpan remainingTime, int currentRetryCount, out TimeSpan retryInterval)

Parameters

remainingTime TimeSpan

The remaining time.

currentRetryCount int

The total number of retries.

retryInterval TimeSpan

The retry interval.

Returns

bool

If this method returns true, the retry operation occurs after the thread becomes idle for an amount of time equal to retryInterval.