• Core
  • Infrastructure
  • Web
  • Extensions
Search Results for

    Show / Hide Table of Contents
    View Source

    Class RetryPolicy

    Provides the base implementation of the retry mechanism for unreliable actions and transient conditions.

    Inheritance
    System.Object
    Namespace: Umbraco.Cms.Infrastructure.Persistence.FaultHandling
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class RetryPolicy

    Constructors

    View Source

    RetryPolicy(ITransientErrorDetectionStrategy, Int32)

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

    Declaration
    public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount)
    Parameters
    Type Name Description
    ITransientErrorDetectionStrategy errorDetectionStrategy

    The ITransientErrorDetectionStrategy that is responsible for detecting transient conditions.

    System.Int32 retryCount

    The number of retry attempts.

    View Source

    RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan)

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

    Declaration
    public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan retryInterval)
    Parameters
    Type Name Description
    ITransientErrorDetectionStrategy errorDetectionStrategy

    The ITransientErrorDetectionStrategy that is responsible for detecting transient conditions.

    System.Int32 retryCount

    The number of retry attempts.

    TimeSpan retryInterval

    The interval between retries.

    View Source

    RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan, TimeSpan)

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

    Declaration
    public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan initialInterval, TimeSpan increment)
    Parameters
    Type Name Description
    ITransientErrorDetectionStrategy errorDetectionStrategy

    The ITransientErrorDetectionStrategy that is responsible for detecting transient conditions.

    System.Int32 retryCount

    The number of retry attempts.

    TimeSpan initialInterval

    The initial interval that will apply for the first retry.

    TimeSpan increment

    The incremental time value that will be used for calculating the progressive delay between retries.

    View Source

    RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan, TimeSpan, TimeSpan)

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

    Declaration
    public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, int retryCount, TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff)
    Parameters
    Type Name Description
    ITransientErrorDetectionStrategy errorDetectionStrategy

    The ITransientErrorDetectionStrategy that is responsible for detecting transient conditions.

    System.Int32 retryCount

    The number of retry attempts.

    TimeSpan minBackoff

    The minimum back-off time.

    TimeSpan maxBackoff

    The maximum back-off time.

    TimeSpan deltaBackoff

    The time value that will be used for calculating a random delta in the exponential delay between retries.

    View Source

    RetryPolicy(ITransientErrorDetectionStrategy, RetryStrategy)

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

    Declaration
    public RetryPolicy(ITransientErrorDetectionStrategy errorDetectionStrategy, RetryStrategy retryStrategy)
    Parameters
    Type Name Description
    ITransientErrorDetectionStrategy errorDetectionStrategy

    The ITransientErrorDetectionStrategy that is responsible for detecting transient conditions.

    RetryStrategy retryStrategy

    The retry strategy to use for this retry policy.

    Fields

    View Source

    DefaultExponential

    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.

    Declaration
    public static readonly RetryPolicy DefaultExponential
    Field Value
    Type Description
    RetryPolicy
    View Source

    DefaultFixed

    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.

    Declaration
    public static readonly RetryPolicy DefaultFixed
    Field Value
    Type Description
    RetryPolicy
    View Source

    DefaultProgressive

    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.

    Declaration
    public static readonly RetryPolicy DefaultProgressive
    Field Value
    Type Description
    RetryPolicy
    View Source

    NoRetry

    Returns a default policy that does no retries, it just invokes action exactly once.

    Declaration
    public static readonly RetryPolicy NoRetry
    Field Value
    Type Description
    RetryPolicy

    Properties

    View Source

    ErrorDetectionStrategy

    Gets the instance of the error detection strategy.

    Declaration
    public ITransientErrorDetectionStrategy ErrorDetectionStrategy { get; }
    Property Value
    Type Description
    ITransientErrorDetectionStrategy
    View Source

    RetryStrategy

    Gets the retry strategy.

    Declaration
    public RetryStrategy RetryStrategy { get; }
    Property Value
    Type Description
    RetryStrategy

    Methods

    View Source

    ExecuteAction(Action)

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

    Declaration
    public virtual void ExecuteAction(Action action)
    Parameters
    Type Name Description
    Action action

    A delegate representing the executable action which doesn't return any results.

    View Source

    ExecuteAction<TResult>(Func<TResult>)

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

    Declaration
    public virtual TResult ExecuteAction<TResult>(Func<TResult> func)
    Parameters
    Type Name Description
    Func<TResult> func

    A delegate representing the executable action which returns the result of type R.

    Returns
    Type Description
    TResult

    The result from the action.

    Type Parameters
    Name Description
    TResult

    The type of result expected from the executable action.

    View Source

    OnRetrying(Int32, Exception, TimeSpan)

    Notifies the subscribers whenever a retry condition is encountered.

    Declaration
    protected virtual void OnRetrying(int retryCount, Exception lastError, TimeSpan delay)
    Parameters
    Type Name Description
    System.Int32 retryCount

    The current retry attempt count.

    Exception lastError

    The exception which caused the retry conditions to occur.

    TimeSpan delay

    The delay indicating how long the current thread will be suspended for before the next iteration will be invoked.

    Events

    View Source

    Retrying

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

    Declaration
    public event EventHandler<RetryingEventArgs>? Retrying
    Event Type
    Type Description
    System.Nullable<EventHandler<RetryingEventArgs>>
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • RetryPolicy(ITransientErrorDetectionStrategy, Int32)
      • RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan)
      • RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan, TimeSpan)
      • RetryPolicy(ITransientErrorDetectionStrategy, Int32, TimeSpan, TimeSpan, TimeSpan)
      • RetryPolicy(ITransientErrorDetectionStrategy, RetryStrategy)
    • Fields
      • DefaultExponential
      • DefaultFixed
      • DefaultProgressive
      • NoRetry
    • Properties
      • ErrorDetectionStrategy
      • RetryStrategy
    • Methods
      • ExecuteAction(Action)
      • ExecuteAction<TResult>(Func<TResult>)
      • OnRetrying(Int32, Exception, TimeSpan)
    • Events
      • Retrying
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX