Class SourceGen
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public static class SourceGen
Methods
| Improve this Doc View SourceUnfoldFlow<TState, TOut, TMat>(TState, IGraph<FlowShape<TState, (TState, TOut)>, TMat>, TimeSpan)
EXPERIMENTAL API
Create a source that will unfold a value of type TState
by
passing it through a flow. The flow should emit a
pair of the next state TState
and output elements of type TOut
.
Source completes when the flow completes.
The timeout
parameter specifies waiting time after inner
flow provided by the user for unfold flow API cancels
upstream, to get also the downstream cancelation (as
graceful completion or failure which is propagated).
If inner flow fails to complete/fail downstream, stage is failed.
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 Source<TOut, TMat> UnfoldFlow<TState, TOut, TMat>(TState seed, IGraph<FlowShape<TState, (TState, TOut)>, TMat> flow, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TState | seed | intial state |
IGraph<FlowShape<TState, System.ValueTuple<TState, TOut>>, TMat> | flow | flow, through which value is passed |
TimeSpan | timeout | timeout |
Returns
Type | Description |
---|---|
Source<TOut, TMat> |
Type Parameters
Name | Description |
---|---|
TState | state type |
TOut | output elements type |
TMat | materialized value type |
UnfoldFlowWith<TOut, TState, TFlowOut, TMat>(TState, IGraph<FlowShape<TState, TFlowOut>, TMat>, Func<TFlowOut, Option<(TState, TOut)>>, TimeSpan)
EXPERIMENTAL API
Create a source that will unfold a value of type TState
by
passing it through a flow. The flow should emit an output
value of type TFlowOut
, that when fed to the unfolding function,
generates a pair of the next state TState
and output elements of type TOut
.
The timeout
parameter specifies waiting time after inner
flow provided by the user for unfold flow API cancels
upstream, to get also the downstream cancelation(as
graceful completion or failure which is propagated).
If inner flow fails to complete/fail downstream, stage is failed.
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 Source<TOut, TMat> UnfoldFlowWith<TOut, TState, TFlowOut, TMat>(TState seed, IGraph<FlowShape<TState, TFlowOut>, TMat> flow, Func<TFlowOut, Option<(TState, TOut)>> unfoldWith, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TState | seed | intial state |
IGraph<FlowShape<TState, TFlowOut>, TMat> | flow | flow through which value is passed |
Func<TFlowOut, Option<System.ValueTuple<TState, TOut>>> | unfoldWith | unfolding function |
TimeSpan | timeout | timeout |
Returns
Type | Description |
---|---|
Source<TOut, TMat> |
Type Parameters
Name | Description |
---|---|
TOut | output elements type |
TState | state type |
TFlowOut | flow output value type |
TMat | materialized value type |