Class RetrySupport
This class provides the retry utility functions.
Inherited Members
Namespace: Akka.Pattern
Assembly: Akka.dll
Syntax
public static class RetrySupport
Methods
| Improve this Doc View SourceRetry<T>(Func<Task<T>>, Int32)
Given a function, returns an internally retrying Task. The first attempt will be made immediately, each subsequent attempt will be made immediately if the previous attempt failed.
If attempts are exhausted the returned Task is simply the result of invoking attempt.Declaration
public static Task<T> Retry<T>(Func<Task<T>> attempt, int attempts)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | attempt | TBD |
Int32 | attempts | TBD |
Returns
Type | Description |
---|---|
Task<T> |
Type Parameters
Name | Description |
---|---|
T |
Retry<T>(Func<Task<T>>, Int32, Func<Int32, Option<TimeSpan>>, IScheduler)
Given a function, returns an internally retrying Task.
The first attempt will be made immediately, each subsequent attempt will be made after
the 'delay' return by delayFunction
(the input next attempt count start from 1).
Returns None for no delay.
A scheduler (eg Context.System.Scheduler) must be provided to delay each retry.
You could provide a function to generate the next delay duration after first attempt,
this function should never return null
, otherwise an InvalidOperationException will be through.
Declaration
public static Task<T> Retry<T>(Func<Task<T>> attempt, int attempts, Func<int, Option<TimeSpan>> delayFunction, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | attempt | TBD |
Int32 | attempts | TBD |
Func<Int32, Option<TimeSpan>> | delayFunction | TBD |
IScheduler | scheduler | The scheduler instance to use. |
Returns
Type | Description |
---|---|
Task<T> |
Type Parameters
Name | Description |
---|---|
T |
Retry<T>(Func<Task<T>>, Int32, TimeSpan, IScheduler)
Given a function, returns an internally retrying Task. The first attempt will be made immediately, each subsequent attempt will be made after 'delay'. A scheduler (eg Context.System.Scheduler) must be provided to delay each retry.
If attempts are exhausted the returned future is simply the result of invoking attempt.Declaration
public static Task<T> Retry<T>(Func<Task<T>> attempt, int attempts, TimeSpan delay, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | attempt | TBD |
Int32 | attempts | TBD |
TimeSpan | delay | TBD |
IScheduler | scheduler | The scheduler instance to use. |
Returns
Type | Description |
---|---|
Task<T> |
Type Parameters
Name | Description |
---|---|
T |
Retry<T>(Func<Task<T>>, Int32, TimeSpan, TimeSpan, Int32, IScheduler)
Given a function, returns an internally retrying Task. The first attempt will be made immediately, each subsequent attempt will be made with a backoff time, if the previous attempt failed.
If attempts are exhausted the returned Task is simply the result of invoking attempt.Declaration
public static Task<T> Retry<T>(Func<Task<T>> attempt, int attempts, TimeSpan minBackoff, TimeSpan maxBackoff, int randomFactor, IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
Func<Task<T>> | attempt | TBD |
Int32 | attempts | TBD |
TimeSpan | minBackoff | minimum (initial) duration until the child actor will started again, if it is terminated. |
TimeSpan | maxBackoff | the exponential back-off is capped to this duration. |
Int32 | randomFactor | after calculation of the exponential back-off an additional random delay based on this factor is added, e.g. |
IScheduler | scheduler | The scheduler instance to use. |
Returns
Type | Description |
---|---|
Task<T> |
Type Parameters
Name | Description |
---|---|
T |