Class Retry
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public static class Retry
Methods
| Improve this Doc View SourceConcat<TIn, TState, TOut, TMat>(Int64, IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat>, Func<TState, IEnumerable<(TIn, TState)>>)
EXPERIMENTAL API
Factory for multiple retries flow. similar to the simple retry, but this will allow to
break down a "heavy" element which failed into multiple "thin" elements, that may succeed individually.
Since it's easy to inflate elements in retry cycle, there's also a limit parameter, that will limit the
amount of generated elements by the retryWith
function, and will fail the stage if that limit is exceeded.
Passing null
is valid, and will result in filtering out the failure quietly, without
emitting a failed Result<T> element.
IMPORTANT CAVEAT: The given flow must not change the number of elements passing through it (i.e. it should output exactly one element for every received element). Ignoring this, will have an unpredicted result, and may result in a deadlock.
Declaration
public static IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat> Concat<TIn, TState, TOut, TMat>(long limit, IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat> flow, Func<TState, IEnumerable<(TIn, TState)>> retryWith)
Parameters
Type | Name | Description |
---|---|---|
Int64 | limit | since every retry can generate more elements, the inner queue can get too big. if the limit is reached, the stage will fail. |
IGraph<FlowShape<System.ValueTuple<TIn, TState>, System.ValueTuple<Result<TOut>, TState>>, TMat> | flow | the flow to retry |
Func<TState, IEnumerable<System.ValueTuple<TIn, TState>>> | retryWith | if output was failure, we can optionaly recover from it, and retry with a sequence of input and new state pairs we get from this function. |
Returns
Type | Description |
---|---|
IGraph<FlowShape<System.ValueTuple<TIn, TState>, System.ValueTuple<Result<TOut>, TState>>, TMat> |
Type Parameters
Name | Description |
---|---|
TIn | input elements type |
TState | state to create a new |
TOut | output elements type |
TMat | materialized value type |
Create<TIn, TState, TOut, TMat>(IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat>, Func<TState, Option<(TIn, TState)>>)
EXPERIMENTAL API
Retry flow factory. given a flow that produces Result<T>s, this wrapping flow may be used to try
and pass failed elements through the flow again. More accurately, the given flow consumes a tuple
of input
and state
, and produces a tuple of Result<T> of output
and state
.
If the flow emits a failed element (i.e. IsSuccess is false), the retryWith
function is fed with the state
of the failed element, and may produce a new input-state tuple to pass through
the original flow. The function may also yield Option.None
instead of (input, state)
, which means not to retry a failed element.
IMPORTANT CAVEAT: The given flow must not change the number of elements passing through it (i.e. it should output exactly one element for every received element). Ignoring this, will have an unpredicted result, and may result in a deadlock.
Declaration
public static IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat> Create<TIn, TState, TOut, TMat>(IGraph<FlowShape<(TIn, TState), (Result<TOut>, TState)>, TMat> flow, Func<TState, Option<(TIn, TState)>> retryWith)
Parameters
Type | Name | Description |
---|---|---|
IGraph<FlowShape<System.ValueTuple<TIn, TState>, System.ValueTuple<Result<TOut>, TState>>, TMat> | flow | the flow to retry |
Func<TState, Option<System.ValueTuple<TIn, TState>>> | retryWith | if output was failure, we can optionaly recover from it, and retry with a new pair of input and new state we get from this function. |
Returns
Type | Description |
---|---|
IGraph<FlowShape<System.ValueTuple<TIn, TState>, System.ValueTuple<Result<TOut>, TState>>, TMat> |
Type Parameters
Name | Description |
---|---|
TIn | input elements type |
TState | state to create a new |
TOut | output elements type |
TMat | materialized value type |