WithFuncAsync Method
Definition
- Namespace
- Cuemon.Resilience
- Assemblies
- Cuemon.Resilience.dll
WithFuncAsync<TResult>(Func<CancellationToken, Task<TResult>>, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<TResult>(Func<CancellationToken, Task<TResult>> faultSensitiveMethod, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.
WithFuncAsync<T, TResult>(Func<T, CancellationToken, Task<TResult>>, T, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<T, TResult>(Func<T, CancellationToken, Task<TResult>> faultSensitiveMethod, T arg, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<T, CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
argTThe parameter of the function delegate
faultSensitiveMethod.setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
TThe type of the parameter of the function delegate
faultSensitiveMethod.TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.
WithFuncAsync<T1, T2, TResult>(Func<T1, T2, CancellationToken, Task<TResult>>, T1, T2, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<T1, T2, TResult>(Func<T1, T2, CancellationToken, Task<TResult>> faultSensitiveMethod, T1 arg1, T2 arg2, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<T1, T2, CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
arg1T1The first parameter of the function delegate
faultSensitiveMethod.arg2T2The second parameter of the function delegate
faultSensitiveMethod.setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
T1The type of the first parameter of the function delegate
faultSensitiveMethod.T2The type of the second parameter of the function delegate
faultSensitiveMethod.TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.
WithFuncAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, CancellationToken, Task<TResult>>, T1, T2, T3, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<T1, T2, T3, TResult>(Func<T1, T2, T3, CancellationToken, Task<TResult>> faultSensitiveMethod, T1 arg1, T2 arg2, T3 arg3, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<T1, T2, T3, CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
arg1T1The first parameter of the function delegate
faultSensitiveMethod.arg2T2The second parameter of the function delegate
faultSensitiveMethod.arg3T3The third parameter of the function delegate
faultSensitiveMethod.setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
T1The type of the first parameter of the function delegate
faultSensitiveMethod.T2The type of the second parameter of the function delegate
faultSensitiveMethod.T3The type of the third parameter of the function delegate
faultSensitiveMethod.TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.
WithFuncAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, CancellationToken, Task<TResult>>, T1, T2, T3, T4, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<T1, T2, T3, T4, TResult>(Func<T1, T2, T3, T4, CancellationToken, Task<TResult>> faultSensitiveMethod, T1 arg1, T2 arg2, T3 arg3, T4 arg4, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<T1, T2, T3, T4, CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
arg1T1The first parameter of the function delegate
faultSensitiveMethod.arg2T2The second parameter of the function delegate
faultSensitiveMethod.arg3T3The third parameter of the function delegate
faultSensitiveMethod.arg4T4The fourth parameter of the function delegate
faultSensitiveMethod.setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
T1The type of the first parameter of the function delegate
faultSensitiveMethod.T2The type of the second parameter of the function delegate
faultSensitiveMethod.T3The type of the third parameter of the function delegate
faultSensitiveMethod.T4The type of the fourth parameter of the function delegate
faultSensitiveMethod.TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.
WithFuncAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>, T1, T2, T3, T4, T5, Action<AsyncTransientOperationOptions>)
Repetitively executes the specified faultSensitiveMethod until the operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
public static Task<TResult> WithFuncAsync<T1, T2, T3, T4, T5, TResult>(Func<T1, T2, T3, T4, T5, CancellationToken, Task<TResult>> faultSensitiveMethod, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, Action<AsyncTransientOperationOptions> setup = null)
Parameters
faultSensitiveMethodFunc<T1, T2, T3, T4, T5, CancellationToken, Task<TResult>>The fault sensitive Task<TResult> based function delegate that is invoked until an operation is successful, the amount of retry attempts has been reached, or a failed operation is not considered related to transient fault condition.
arg1T1The first parameter of the function delegate
faultSensitiveMethod.arg2T2The second parameter of the function delegate
faultSensitiveMethod.arg3T3The third parameter of the function delegate
faultSensitiveMethod.arg4T4The fourth parameter of the function delegate
faultSensitiveMethod.arg5T5The fifth parameter of the function delegate
faultSensitiveMethod.setupAction<AsyncTransientOperationOptions>The AsyncTransientOperationOptions which may be configured.
Returns
- Task<TResult>
The result from the
faultSensitiveMethod.
Type Parameters
T1The type of the first parameter of the function delegate
faultSensitiveMethod.T2The type of the second parameter of the function delegate
faultSensitiveMethod.T3The type of the third parameter of the function delegate
faultSensitiveMethod.T4The type of the fourth parameter of the function delegate
faultSensitiveMethod.T5The type of the fifth parameter of the function delegate
faultSensitiveMethod.TResultThe type of the return value of the function delegate
faultSensitiveMethod.
Exceptions
- ArgumentNullException
faultSensitiveMethodcannot be null.- LatencyException
The
faultSensitiveMethodexceeded the maximum time allowed to network latency.- AggregateException
The
faultSensitiveMethodwas a victim of a transient fault. The InnerExceptions collection contains a TransientFaultException object.-or
An exception was thrown during the invocation of the
faultSensitiveMethod. The InnerExceptions collection contains information about the exception or exceptions.