Rsft.EntLib.TransientFaultHandling.Standard by Rolosoft Ltd

<PackageReference Include="Rsft.EntLib.TransientFaultHandling.Standard" Version="7.0.0" />

 RetryPolicy

public class RetryPolicy
Provides the base implementation of the retry mechanism for unreliable actions and transient conditions.
public static RetryPolicy DefaultExponential { get; }

Returns a default policy that implements a random exponential retry interval configured with the default FixedInterval retry strategy. The default retry policy treats all caught exceptions as transient errors.

public static RetryPolicy DefaultFixed { get; }

Returns a default policy that implements a fixed retry interval configured with the default FixedInterval retry strategy. The default retry policy treats all caught exceptions as transient errors.

public static RetryPolicy DefaultProgressive { get; }

Returns a default policy that implements a progressive retry interval configured with the default Incremental retry strategy. The default retry policy treats all caught exceptions as transient errors.

public static RetryPolicy NoRetry { get; }

Returns a default policy that performs no retries, but invokes the action only once.

Gets the instance of the error detection strategy.

public RetryStrategy RetryStrategy { get; }

Gets the retry strategy.

An instance of a callback delegate that will be invoked whenever a retry condition is encountered.

public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, RetryStrategy retryStrategy)

Initializes a new instance of the RetryPolicy class with the specified number of retry attempts and parameters defining the progressive delay between retries.

public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount)

Initializes a new instance of the RetryPolicy class with the specified number of retry attempts and default fixed time interval between retries.

public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan retryInterval)

Initializes a new instance of the RetryPolicy class with the specified number of retry attempts and fixed time interval between retries.

public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff)

Initializes a new instance of the RetryPolicy class with the specified number of retry attempts and backoff parameters for calculating the exponential delay between retries.

public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan initialInterval, TimeSpan increment)

Initializes a new instance of the RetryPolicy class with the specified number of retry attempts and parameters defining the progressive delay between retries.

public virtual void ExecuteAction(Action action)

Repetitively executes the specified action while it satisfies the current retry policy.

public virtual TResult ExecuteAction<TResult>(Func<TResult> func)

Repetitively executes the specified action while it satisfies the current retry policy.

public Task ExecuteAsync(Func<Task> taskAction)

Repetitively executes the specified asynchronous task while it satisfies the current retry policy.

public Task ExecuteAsync(Func<Task> taskAction, CancellationToken cancellationToken)

Repetitively executes the specified asynchronous task while it satisfies the current retry policy.

public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> taskFunc)

Repeatedly executes the specified asynchronous task while it satisfies the current retry policy.

public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> taskFunc, CancellationToken cancellationToken)

Repeatedly executes the specified asynchronous task while it satisfies the current retry policy.

protected virtual void OnRetrying(int retryCount, Exception lastError, TimeSpan delay)

Notifies the subscribers whenever a retry condition is encountered.