kCura.Data.RowDataGateway.Utility.RetryHelper
Provides access to methods for retrying a provided delegate with either failover or retry.
public static void BasicRetry(Action func, int retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator)
Executes the provided action, conditionally retrying the provided number of times.
public static void BasicRetry(Action func, Func<int> retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, Func<int, TimeSpan> waitLogic)
public static T BasicRetry<T>(Func<T> func, int retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator)
Executes the provided function, conditionally retrying the provided number of times.
public static T BasicRetry<T>(Func<T> func, Func<int> retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, Func<int, TimeSpan> waitLogic)
public static Task BasicRetryAsync(Func<Task> func, int retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, CancellationToken cancelToken)
public static Task BasicRetryAsync(Func<Task> func, Func<int> retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, Func<int, TimeSpan> waitLogic, CancellationToken cancelToken)
Asynchronously executes the provided action, conditionally retrying the provided number of times.
public static Task<T> BasicRetryAsync<T>(Func<Task<T>> func, int retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, CancellationToken cancelToken)
public static Task<T> BasicRetryAsync<T>(Func<Task<T>> func, Func<int> retrys, Func<Exception, bool> retryLogic, Func<Exception, IEnumerable<Exception>, Exception> exceptionAggratator, Func<int, TimeSpan> waitLogic, CancellationToken cancelToken)
Asynchronously executes the provided function, conditionally retrying the provided number of times.
public static void TryWithFailover(Action baseLogic, Action failoverLogic, Func<Exception, bool> checkToFailOver)
Attempts to execute the provided action. Conditionally executes a failover action based on the exception thrown.
public static T TryWithFailover<T>(Func<T> baseLogic, Func<T> failoverLogic, Func<Exception, bool> checkToFailover)
Attempts to execute the provided function. Conditionally executes a failover function based on the exception thrown.
public static Task TryWithFailoverAsync(Func<Task> baseLogic, Func<Task> failoverLogic, Func<Exception, bool> checkToFailover, CancellationToken cancellationToken)
Asynchronously attempts to execute the provided action. Conditionally executes failover logic based on the exception thrown.
public static Task<T> TryWithFailoverAsync<T>(Func<Task<T>> baseLogic, Func<Task<T>> failoverLogic, Func<Exception, bool> checkToFailover, CancellationToken cancellationToken)
Asynchronously attempts to execute the provided function. Conditionally executes failover logic based on the exception thrown.