Table of Contents

Class RetryPolicy

Namespace
Microsoft.Azure.ServiceBus
Assembly
Microsoft.Azure.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

Constructors

RetryPolicy()

protected RetryPolicy()

Properties

Default

Returns the default retry policy, RetryExponential.

public static RetryPolicy Default { get; }

Property Value

RetryPolicy

IsServerBusy

Determines whether or not the server returned a busy error.

public bool IsServerBusy { get; protected set; }

Property Value

bool

ServerBusyExceptionMessage

Gets the exception message when a server busy error is returned.

public string ServerBusyExceptionMessage { get; protected set; }

Property Value

string

Methods

IsRetryableException(Exception)

Determines whether or not the exception can be retried.

public virtual bool IsRetryableException(Exception exception)

Parameters

exception Exception

Returns

bool

A bool indicating whether or not the operation can be retried.

OnShouldRetry(TimeSpan, int, out TimeSpan)

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

Parameters

remainingTime TimeSpan
currentRetryCount int
retryInterval TimeSpan

Returns

bool

RunOperation(Func<Task>, TimeSpan)

Runs a Func<T, TResult>, using the current RetryPolicy.

public Task RunOperation(Func<Task> operation, TimeSpan operationTimeout)

Parameters

operation Func<Task>

A Func<T, TResult> to be executed.

operationTimeout TimeSpan

The timeout for the entire operation.

Returns

Task