Overview
TheResiliencePipeline class is used to execute user-provided callbacks with configured resilience strategies. It provides a unified API for synchronous and asynchronous callbacks, with and without return values.
Static Properties
ResiliencePipeline
A resilience pipeline that executes the user-provided callback without any additional logic.
Synchronous Execute Methods
Execute (Action)
Action
required
The user-provided callback.
ArgumentNullException
Thrown when
callback is null.Execute (Action<CancellationToken>)
Action<CancellationToken>
required
The user-provided callback.
CancellationToken
The cancellation token associated with the callback.
Execute (Action<TState>)
Action<TState>
required
The user-provided callback.
TState
The state associated with the callback.
Execute (Action<TState, CancellationToken>)
Action<TState, CancellationToken>
required
The user-provided callback.
TState
The state associated with the callback.
CancellationToken
The cancellation token associated with the callback.
Execute (Action<ResilienceContext>)
Action<ResilienceContext>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
Execute (Action<ResilienceContext, TState>)
Action<ResilienceContext, TState>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
TState
The state associated with the callback.
Synchronous Execute Methods with Result
Execute (Func<TResult>)
Func<TResult>
required
The user-provided callback.
TResult
The result of the callback execution.
Execute (Func<CancellationToken, TResult>)
Func<CancellationToken, TResult>
required
The user-provided callback.
CancellationToken
The cancellation token associated with the callback.
TResult
The result of the callback execution.
Execute (Func<TState, TResult>)
Func<TState, TResult>
required
The user-provided callback.
TState
The state associated with the callback.
TResult
The result of the callback execution.
Execute (Func<TState, CancellationToken, TResult>)
Func<TState, CancellationToken, TResult>
required
The user-provided callback.
TState
The state associated with the callback.
CancellationToken
The cancellation token associated with the callback.
TResult
The result of the callback execution.
Execute (Func<ResilienceContext, TResult>)
Func<ResilienceContext, TResult>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
TResult
The result of the callback execution.
Execute (Func<ResilienceContext, TState, TResult>)
Func<ResilienceContext, TState, TResult>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
TState
The state associated with the callback.
TResult
The result of the callback execution.
Asynchronous Execute Methods
ExecuteAsync (Func<CancellationToken, ValueTask>)
Func<CancellationToken, ValueTask>
required
The user-provided callback.
CancellationToken
The cancellation token associated with the callback.
ValueTask
A task that represents the asynchronous execution.
ExecuteAsync (Func<TState, CancellationToken, ValueTask>)
Func<TState, CancellationToken, ValueTask>
required
The user-provided callback.
TState
The state associated with the callback.
CancellationToken
The cancellation token associated with the callback.
ValueTask
A task that represents the asynchronous execution.
ExecuteAsync (Func<ResilienceContext, ValueTask>)
Func<ResilienceContext, ValueTask>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
ValueTask
A task that represents the asynchronous execution.
ExecuteAsync (Func<ResilienceContext, TState, ValueTask>)
Func<ResilienceContext, TState, ValueTask>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
TState
The state associated with the callback.
ValueTask
A task that represents the asynchronous execution.
Asynchronous Execute Methods with Result
ExecuteAsync (Func<CancellationToken, ValueTask<TResult>>)
Func<CancellationToken, ValueTask<TResult>>
required
The user-provided callback.
CancellationToken
The cancellation token associated with the callback.
ValueTask<TResult>
A task that represents the asynchronous execution and returns the result.
ExecuteAsync (Func<TState, CancellationToken, ValueTask<TResult>>)
Func<TState, CancellationToken, ValueTask<TResult>>
required
The user-provided callback.
TState
The state associated with the callback.
CancellationToken
The cancellation token associated with the callback.
ValueTask<TResult>
A task that represents the asynchronous execution and returns the result.
ExecuteAsync (Func<ResilienceContext, ValueTask<TResult>>)
Func<ResilienceContext, ValueTask<TResult>>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
ValueTask<TResult>
A task that represents the asynchronous execution and returns the result.
ExecuteAsync (Func<ResilienceContext, TState, ValueTask<TResult>>)
Func<ResilienceContext, TState, ValueTask<TResult>>
required
The user-provided callback.
ResilienceContext
required
The context associated with the callback.
TState
The state associated with the callback.
ValueTask<TResult>
A task that represents the asynchronous execution and returns the result.
Advanced Execute Methods
ExecuteOutcomeAsync
Func<ResilienceContext, TState, ValueTask<Outcome<TResult>>>
required
The user-provided callback that returns an
Outcome<TResult>.ResilienceContext
required
The context associated with the callback.
TState
The state associated with the callback.
ValueTask<Outcome<TResult>>
A task that represents the asynchronous execution and returns the outcome.
ResiliencePipeline<T>
A generic version ofResiliencePipeline that constrains result types to T.
Static Properties
ResiliencePipeline<T>
A resilience pipeline that executes the user-provided callback without any additional logic.
Execute Methods
All execute methods fromResiliencePipeline are available with an additional constraint that TResult : T.