Class SubFlowOperations
TBD
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public static class SubFlowOperations
Methods
| Improve this Doc View SourceAggregate<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>)
Similar to Scan<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>) but only emits its result when the upstream completes,
after which it also completes. Applies the given function fold
towards its current and next value,
yielding the next current value.
If the function fold
throws an exception and the supervision decision is
Restart current value starts at zero
again
the stream will continue.
Emits when upstream completes
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> Aggregate<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, TOut2 zero, Func<TOut2, TOut1, TOut2> fold)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
TOut2 | zero | TBD |
Func<TOut2, TOut1, TOut2> | fold | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
AggregateAsync<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, TOut, Func<TOut, TIn, Task<TOut>>)
Similar to Aggregate<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>) but with an asynchronous function. Applies the given function towards its current and next value, yielding the next current value.
If the function fold
returns a failure and the supervision decision is
Restart current value starts at zero
again
the stream will continue.
Emits when upstream completes
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancels Aggregate<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>)Declaration
public static SubFlow<TOut, TMat, TClosed> AggregateAsync<TIn, TOut, TMat, TClosed>(this SubFlow<TIn, TMat, TClosed> flow, TOut zero, Func<TOut, TIn, Task<TOut>> fold)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TIn, TMat, TClosed> | flow | TBD |
TOut | zero | TBD |
Func<TOut, TIn, Task<TOut>> | fold | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
TMat | TBD |
TClosed | TBD |
AlsoTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements that passes through will also be sent to the Sink<TIn, TMat>.
Emits when element is available and demand exists both from the Sink and the downstream.
Backpressures when downstream or Sink backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> AlsoTo<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat> that)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat> | that | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
AlsoTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>, Boolean)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements that passes through will also be sent to the Sink<TIn, TMat>.
Emits when element is available and demand exists both from the Sink and the downstream.
Backpressures when downstream or Sink backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> AlsoTo<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat> that, bool propagateFailure)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat> | that | TBD |
Boolean | propagateFailure | Propagate downstream failures and cancels parent stream |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
AlsoToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat2>, Func<TMat, TMat2, TMat3>)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements that passes through will also be sent to the Sink<TIn, TMat>.
@see AlsoTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>)
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<TOut, TMat3, TClosed> AlsoToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat2> that, Func<TMat, TMat2, TMat3> materializerFunction)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat2> | that | TBD |
Func<TMat, TMat2, TMat3> | materializerFunction | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat3, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TMat2 | TBD |
TMat3 | TBD |
TClosed | TBD |
AlsoToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat2>, Func<TMat, TMat2, TMat3>, Boolean)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements that passes through will also be sent to the Sink<TIn, TMat>.
@see AlsoTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>, Boolean)
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<TOut, TMat3, TClosed> AlsoToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat2> that, Func<TMat, TMat2, TMat3> materializerFunction, bool propagateFailure)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat2> | that | TBD |
Func<TMat, TMat2, TMat3> | materializerFunction | TBD |
Boolean | propagateFailure | Propagate downstream failures and cancels parent stream |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat3, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TMat2 | TBD |
TMat3 | TBD |
TClosed | TBD |
BackpressureTimeout<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
If the time between the emission of an element and the following downstream demand exceeds the provided timeout, the stream is failed with a TimeoutException. The timeout is checked periodically, so the resolution of the check is one period (equals to timeout value).
Emits when upstream emits an element
Backpressures when downstream backpressuresCompletes when upstream completes or fails if timeout elapses between element emission and downstream demand.
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> BackpressureTimeout<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Batch<TOut, TOut2, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64, Func<TOut, TOut2>, Func<TOut2, TOut, TOut2>)
Allows a faster upstream to progress independently of a slower subscriber by aggregating elements into batches until the subscriber is ready to accept them.For example a batch step might store received elements in an array up to the allowed max limit if the upstream publisher is faster.
This only rolls up elements if the upstream is faster, but if the downstream is faster it will not duplicate elements.
Emits when downstream stops backpressuring and there is an aggregated element available
Backpressures when there are max
batched elements and 1 pending element and downstream backpressures
Completes when upstream completes and there is no batched/pending element waiting
Cancels when downstream cancels
See also ConflateWithSeed<TOut, TMat, TSeed, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TSeed>, Func<TSeed, TOut, TSeed>), BatchWeighted<TOut, TOut2, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64, Func<TOut, Int64>, Func<TOut, TOut2>, Func<TOut2, TOut, TOut2>)
Declaration
public static SubFlow<TOut2, TMat, TClosed> Batch<TOut, TOut2, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, long max, Func<TOut, TOut2> seed, Func<TOut2, TOut, TOut2> aggregate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int64 | max | maximum number of elements to batch before backpressuring upstream (must be positive non-zero) |
Func<TOut, TOut2> | seed | Provides the first state for a batched value using the first unconsumed element as a start |
Func<TOut2, TOut, TOut2> | aggregate | Takes the currently batched value and the current pending element to produce a new aggregate |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
BatchWeighted<TOut, TOut2, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64, Func<TOut, Int64>, Func<TOut, TOut2>, Func<TOut2, TOut, TOut2>)
Allows a faster upstream to progress independently of a slower subscriber by aggregating elements into batches until the subscriber is ready to accept them.For example a batch step might concatenate ByteString elements up to the allowed max limit if the upstream publisher is faster.
This element only rolls up elements if the upstream is faster, but if the downstream is faster it will not duplicate elements.
Batching will apply for all elements, even if a single element cost is greater than the total allowed limit.
In this case, previous batched elements will be emitted, then the "heavy" element will be emitted (after
being applied with the seed
function) without batching further elements with it, and then the rest of the
incoming elements are batched.
Emits when downstream stops backpressuring and there is a batched element available
Backpressures when there are max
weighted batched elements + 1 pending element and downstream backpressures
Completes when upstream completes and there is no batched/pending element waiting
Cancels when downstream cancels
See also ConflateWithSeed<TOut, TMat, TSeed, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TSeed>, Func<TSeed, TOut, TSeed>), Batch<TOut, TOut2, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64, Func<TOut, TOut2>, Func<TOut2, TOut, TOut2>)
Declaration
public static SubFlow<TOut2, TMat, TClosed> BatchWeighted<TOut, TOut2, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, long max, Func<TOut, long> costFunction, Func<TOut, TOut2> seed, Func<TOut2, TOut, TOut2> aggregate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int64 | max | maximum weight of elements to batch before backpressuring upstream (must be positive non-zero) |
Func<TOut, Int64> | costFunction | a function to compute a single element weight |
Func<TOut, TOut2> | seed | Provides the first state for a batched value using the first unconsumed element as a start |
Func<TOut2, TOut, TOut2> | aggregate | Takes the currently batched value and the current pending element to produce a new aggregate |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Buffer<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32, OverflowStrategy)
Adds a fixed size buffer in the flow that allows to store elements from a faster upstream until it becomes full. Depending on the defined OverflowStrategy it might drop elements or backpressure the upstream if there is no space available
Emits when downstream stops backpressuring and there is a pending element in the buffer
Backpressures when downstream backpressures or depending on OverflowStrategy:* Backpressure - backpressures when buffer is full
* DropHead, DropTail, DropBuffer - never backpressures
* Fail - fails the stream if buffer gets full
Completes when upstream completes and buffered elements has been drained
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Buffer<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int size, OverflowStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | size | The size of the buffer in element count |
OverflowStrategy | strategy | Strategy that is used when incoming elements cannot fit inside the buffer |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Collect<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, TOut2>)
Transform this stream by applying the given function collector
to each of the elements
on which the function is defined (read: returns not null) as they pass through this processing step.
Non-matching elements are filtered out.
Emits when the provided function collector
is defined for the element
collector
is defined for the element and downstream backpressures
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> Collect<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<TOut1, TOut2> collector)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<TOut1, TOut2> | collector | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
CompletionTimeout<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
If the completion of the stream does not happen until the provided timeout, the stream is failed with a TimeoutException.
Emits when upstream emits an element
Backpressures when downstream backpressuresCompletes when upstream completes or fails if timeout elapses before upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> CompletionTimeout<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Concat<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SourceShape<TOut>, TMat>)
Concatenate the given Source<TOut, TMat> to this IFlow<TOut, TMat>, meaning that once this Flow’s input is exhausted and all result elements have been generated, the Source’s elements will be produced.
Note that the Source<TOut, TMat> is materialized together with this IFlow<TOut, TMat> and just kept from producing elements by asserting back-pressure until its time comes.
If this IFlow<TOut, TMat> gets upstream error - no elements from the given Source<TOut, TMat> will be pulled.
Emits when element is available from current stream or from the given Source<TOut, TMat> when current is completed
Backpressures when downstream backpressuresCompletes when given Source<TOut, TMat> completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Concat<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SourceShape<TOut>, TMat> other)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut>, TMat> | other | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
ConcatMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, IGraph<SourceShape<TOut2>, TMat>>)
Transform each input element into a Source<TOut, TMat> of output elements that is then flattened into the output stream by concatenation, fully consuming one Source after the other.
Emits when a currently consumed substream has an element available
Backpressures when downstream backpressuresCompletes when upstream completes and all consumed substreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> ConcatMany<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<TOut1, IGraph<SourceShape<TOut2>, TMat>> flatten)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<TOut1, IGraph<SourceShape<TOut2>, TMat>> | flatten | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Conflate<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TOut, TOut>)
Allows a faster upstream to progress independently of a slower subscriber by conflating elements into a summary until the subscriber is ready to accept them. For example a conflate step might average incoming numbers if the upstream publisher is faster.
This version of conflate does not change the output type of the stream. See ConflateWithSeed<TOut, TMat, TSeed, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TSeed>, Func<TSeed, TOut, TSeed>) for a more flexible version that can take a seed function and transform elements while rolling up.
This element only rolls up elements if the upstream is faster, but if the downstream is faster it will not duplicate elements.
Emits when downstream stops backpressuring and there is a conflated element available
Backpressures when neverCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Conflate<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<TOut, TOut, TOut> aggregate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<TOut, TOut, TOut> | aggregate | Takes the currently aggregated value and the current pending element to produce a new aggregate |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
ConflateWithSeed<TOut, TMat, TSeed, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TSeed>, Func<TSeed, TOut, TSeed>)
Allows a faster upstream to progress independently of a slower subscriber by conflating elements into a summary until the subscriber is ready to accept them. For example a conflate step might average incoming numbers if the upstream publisher is faster.
This version of conflate allows to derive a seed from the first element and change the aggregated type to be different than the input type. See Conflate<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TOut, TOut>) for a simpler version that does not change types.
This element only rolls up elements if the upstream is faster, but if the downstream is faster it will not duplicate elements.
Emits when downstream stops backpressuring and there is a conflated element available
Backpressures when neverCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TSeed, TMat, TClosed> ConflateWithSeed<TOut, TMat, TSeed, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<TOut, TSeed> seed, Func<TSeed, TOut, TSeed> aggregate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<TOut, TSeed> | seed | Provides the first state for a conflated value using the first unconsumed element as a start |
Func<TSeed, TOut, TSeed> | aggregate | Takes the currently aggregated value and the current pending element to produce a new aggregate |
Returns
Type | Description |
---|---|
SubFlow<TSeed, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TSeed | TBD |
TClosed | TBD |
Delay<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan, Nullable<DelayOverflowStrategy>)
Shifts elements emission in time by a specified amount. It allows to store elements in internal buffer while waiting for next element to be emitted. Depending on the defined DelayOverflowStrategy it might drop elements or backpressure the upstream if there is no space available in the buffer.
Delay precision is 10ms to avoid unnecessary timer scheduling cycles
Internal buffer has default capacity 16. You can set buffer size by calling CreateInputBuffer(Int32, Int32)
Emits when there is a pending element in the buffer and configured time for this element elapsed
* EmitEarly - strategy do not wait to emit element if buffer is full
Backpressures when depending on OverflowStrategy* Backpressure - backpressures when buffer is full
* DropHead, DropTail, DropBuffer - never backpressures
* Fail - fails the stream if buffer gets full
Completes when upstream completes and buffered elements has been drained
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Delay<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan of, DelayOverflowStrategy? strategy = null)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | of | Time to shift all messages. |
Nullable<DelayOverflowStrategy> | strategy | Strategy that is used when incoming elements cannot fit inside the buffer |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Detach<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>)
Detaches upstream demand from downstream demand without detaching the stream rates; in other words acts like a buffer of size 1.
Emits when upstream emits an element
Backpressures when downstream backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> Detach<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
DivertTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>, Func<TOut, Boolean>)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements
will be sent to the Sink<TIn, TMat> instead of being passed through if the predicate when
returns true
.
Emits when an element is available from the input and the chosen output has demand
Backpressures when the currently chosen output back-pressures
Completes when upstream completes and no output is pending
Cancels when when all downstreams cancel
Declaration
public static SubFlow<TOut, TMat, TClosed> DivertTo<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat> that, Func<TOut, bool> when)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat> | that | TBD |
Func<TOut, Boolean> | when | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
DivertToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat2>, Func<TOut, Boolean>, Func<TMat, TMat2, TMat3>)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, meaning that elements
will be sent to the Sink<TIn, TMat> instead of being passed through if the predicate when
returns true
.
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<TOut, TMat3, TClosed> DivertToMaterialized<TOut, TMat, TMat2, TMat3, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat2> that, Func<TOut, bool> when, Func<TMat, TMat2, TMat3> materializerFunction)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SinkShape<TOut>, TMat2> | that | TBD |
Func<TOut, Boolean> | when | TBD |
Func<TMat, TMat2, TMat3> | materializerFunction | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat3, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TMat2 | TBD |
TMat3 | TBD |
TClosed | TBD |
Expand<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, IEnumerator<TOut2>>)
Allows a faster downstream to progress independently of a slower publisher by extrapolating elements from an older element until new element comes from the upstream. For example an expand step might repeat the last element for the subscriber until it receives an update from upstream.
This element will never "drop" upstream elements as all elements go through at least one extrapolation step. This means that if the upstream is actually faster than the upstream it will be backpressured by the downstream subscriber.
Expand does not support Restart and Resume.
Exceptions from the extrapolate
function will complete the stream with failure.
Emits when downstream stops backpressuring
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> Expand<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<TOut1, IEnumerator<TOut2>> extrapolate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<TOut1, IEnumerator<TOut2>> | extrapolate | Takes the current extrapolation state to produce an output element and the next extrapolation state. |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Grouped<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32)
Chunk up this stream into groups of the given size, with the last group
possibly smaller than requested due to end-of-stream.
n
must be positive, otherwise ArgumentException is thrown.
Emits when the specified number of elements has been accumulated or upstream completed
Backpressures when a group has been assembled and downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<IEnumerable<TOut>, TMat, TClosed> Grouped<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int n)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | n | TBD |
Returns
Type | Description |
---|---|
SubFlow<IEnumerable<TOut>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown, if |
GroupedWeightedWithin<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64, Int32, TimeSpan, Func<TOut, Int64>)
Chunk up this stream into groups of elements received within a time window, or limited by the weight of the elements, whatever happens first. Empty groups will not be emitted if no elements are received from upstream. The last group before end-of-stream will contain the buffered elements since the previously emitted group.
maxWeight
must be positive, and interval
must be greater than 0 seconds,
otherwise ArgumentException is thrown.
Emits when the configured time elapses since the last group has been emitted or weight limit reached
Backpressures when downstream backpressures, and buffered group(+ pending element) weighs more than maxWeight
Completes when upstream completes(emits last group)
Cancels when downstream completes
Declaration
public static SubFlow<IEnumerable<TOut>, TMat, TClosed> GroupedWeightedWithin<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, long maxWeight, int maxNumber, TimeSpan interval, Func<TOut, long> costFn)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int64 | maxWeight | TBD |
Int32 | maxNumber | TBD |
TimeSpan | interval | TBD |
Func<TOut, Int64> | costFn | TBD |
Returns
Type | Description |
---|---|
SubFlow<IEnumerable<TOut>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
GroupedWithin<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32, TimeSpan)
Chunk up this stream into groups of elements received within a time window, or limited by the given number of elements, whatever happens first. Empty groups will not be emitted if no elements are received from upstream. The last group before end-of-stream will contain the buffered elements since the previously emitted group.
n
must be positive, and timeout
must be greater than 0 seconds, otherwise
ArgumentException is thrown.
Emits when the configured time elapses since the last group has been emitted or n
elements is buffered
n+1
buffered elements
Completes when upstream completes (emits last group)
Cancels when downstream completesDeclaration
public static SubFlow<IEnumerable<TOut>, TMat, TClosed> GroupedWithin<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int n, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | n | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
SubFlow<IEnumerable<TOut>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
IdleTimeout<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
If the time between two processed elements exceed the provided timeout, the stream is failed with a TimeoutException. The timeout is checked periodically, so the resolution of the check is one period (equals to timeout value).
Emits when upstream emits an element
Backpressures when downstream backpressuresCompletes when upstream completes or fails if timeout elapses between two emitted elements
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> IdleTimeout<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
InitialDelay<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
Delays the initial element by the specified duration.
Emits when upstream emits an element if the initial delay is already elapsed
Backpressures when downstream backpressures or initial delay is not yet elapsedCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> InitialDelay<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | delay | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
InitialTimeout<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
If the first element has not passed through this stage before the provided timeout, the stream is failed with a TimeoutException.
Emits when upstream emits an element
Backpressures when downstream backpressuresCompletes when upstream completes or fails if timeout elapses before first element arrives
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> InitialTimeout<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | timeout | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Interleave<T1, T2, TMat, TClosed>(SubFlow<T1, TMat, TClosed>, IGraph<SourceShape<T2>, TMat>, Int32)
Interleave is a deterministic merge of the given Source<TOut, TMat> with elements of this IFlow<TOut, TMat>.
It first emits segmentSize
number of elements from this flow to downstream, then - same amount for other
source, then repeat process.
After one of upstreams is complete than all the rest elements will be emitted from the second one
If it gets error from one of upstreams - stream completes with failure.
Emits when element is available from the currently consumed upstream
Backpressures when downstream backpressures. Signal to current upstream, switch to next upstream when receivedsegmentSize
elements
Completes when the IFlow<TOut, TMat> and given Source<TOut, TMat> completes
Cancels when downstream cancelsDeclaration
public static SubFlow<T2, TMat, TClosed> Interleave<T1, T2, TMat, TClosed>(this SubFlow<T1, TMat, TClosed> flow, IGraph<SourceShape<T2>, TMat> other, int segmentSize)
where T1 : T2
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<T2>, TMat> | other | TBD |
Int32 | segmentSize | TBD |
Returns
Type | Description |
---|---|
SubFlow<T2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T1 | TBD |
T2 | TBD |
TMat | TBD |
TClosed | TBD |
Examples
Source(List(1, 2, 3)).Interleave(List(4, 5, 6, 7), 2) // 1, 2, 4, 5, 3, 6, 7
|
Improve this Doc
View Source
InterleaveMaterialized<T1, T2, TMat, TMat2, TMat3, TClosed>(SubFlow<T1, TMat, TClosed>, IGraph<SourceShape<T2>, TMat2>, Int32, Func<TMat, TMat2, TMat3>)
Interleave is a deterministic merge of the given Source<TOut, TMat> with elements of this IFlow<TOut, TMat>.
It first emits segmentSize
number of elements from this flow to downstream, then - same amount for graph
source,
then repeat process.
After one of upstreams is complete than all the rest elements will be emitted from the second one
If it gets error from one of upstreams - stream completes with failure.
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<T2, TMat3, TClosed> InterleaveMaterialized<T1, T2, TMat, TMat2, TMat3, TClosed>(this SubFlow<T1, TMat, TClosed> flow, IGraph<SourceShape<T2>, TMat2> graph, int segmentSize, Func<TMat, TMat2, TMat3> combine)
where T1 : T2
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<T2>, TMat2> | graph | TBD |
Int32 | segmentSize | TBD |
Func<TMat, TMat2, TMat3> | combine | TBD |
Returns
Type | Description |
---|---|
SubFlow<T2, TMat3, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T1 | TBD |
T2 | TBD |
TMat | TBD |
TMat2 | TBD |
TMat3 | TBD |
TClosed | TBD |
Intersperse<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TOut)
Intersperses stream with provided element, similar to how Join(String, String[]) injects a separator between a collection's elements.
Additionally can inject start and end marker elements to stream.
In case you want to only prepend or only append an element (yet still use the intercept feature to inject a separator between elements, you may want to use the following pattern instead of the 3-argument version of intersperse (See Concat<TIn, TOut> for semantics details).
Emits when upstream emits (or before with the inject
element if provided)
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Intersperse<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TOut inject)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TOut | inject | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
Intersperse<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TOut, TOut, TOut)
Intersperses stream with provided element, similar to how Join(String, String[]) injects a separator between a collection's elements.
Additionally can inject start and end marker elements to stream.
In case you want to only prepend or only append an element (yet still use the intercept feature to inject a separator between elements, you may want to use the following pattern instead of the 3-argument version of intersperse (See Concat<TIn, TOut> for semantics details).
Emits when upstream emits (or before with the start
element if provided)
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Intersperse<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TOut start, TOut inject, TOut end)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TOut | start | TBD |
TOut | inject | TBD |
TOut | end | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when any of the |
KeepAlive<TOut, TInjected, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan, Func<TInjected>)
Injects additional elements if the upstream does not emit for a configured amount of time. In other words, this stage attempts to maintains a base rate of emitted elements towards the downstream.
If the downstream backpressures then no element is injected until downstream demand arrives. Injected elements do not accumulate during this period.
Upstream elements are always preferred over injected elements.
Emits when upstream emits an element or if the upstream was idle for the configured period
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TInjected, TMat, TClosed> KeepAlive<TOut, TInjected, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan timeout, Func<TInjected> injectElement)
where TOut : TInjected
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | timeout | TBD |
Func<TInjected> | injectElement | TBD |
Returns
Type | Description |
---|---|
SubFlow<TInjected, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TInjected | TBD |
TMat | TBD |
TClosed | TBD |
Limit<T, TMat, TClosed>(SubFlow<T, TMat, TClosed>, Int64)
Ensure stream boundedness by limiting the number of elements from upstream.
If the number of incoming elements exceeds max
, it will signal
upstream failure StreamLimitReachedException downstream.
Due to input buffering some elements may have been requested from upstream publishers that will then not be processed downstream of this step.
The stream will be completed without producing any elements if max
is zero
or negative.
Emits when the specified number of elements to take has not yet been reached
Backpressures when downstream backpressuresCompletes when the defined number of elements has been taken or upstream completes
Cancels when the defined number of elements has been taken or downstream cancelsDeclaration
public static SubFlow<T, TMat, TClosed> Limit<T, TMat, TClosed>(this SubFlow<T, TMat, TClosed> flow, long max)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T, TMat, TClosed> | flow | TBD |
Int64 | max | TBD |
Returns
Type | Description |
---|---|
SubFlow<T, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T | TBD |
TMat | TBD |
TClosed | TBD |
See Also
LimitWeighted<T, TMat, TClosed>(SubFlow<T, TMat, TClosed>, Int64, Func<T, Int64>)
Ensure stream boundedness by evaluating the cost of incoming elements
using a cost function. Exactly how many elements will be allowed to travel downstream depends on the
evaluated cost of each element. If the accumulated cost exceeds max
, it will signal
upstream failure StreamLimitReachedException downstream.
Due to input buffering some elements may have been requested from upstream publishers that will then not be processed downstream of this step.
The stream will be completed without producing any elements if max
is zero
or negative.
Emits when the specified number of elements to take has not yet been reached
Backpressures when downstream backpressuresCompletes when the defined number of elements has been taken or upstream completes
Cancels when the defined number of elements has been taken or downstream cancelsDeclaration
public static SubFlow<T, TMat, TClosed> LimitWeighted<T, TMat, TClosed>(this SubFlow<T, TMat, TClosed> flow, long max, Func<T, long> costFunc)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T, TMat, TClosed> | flow | TBD |
Int64 | max | TBD |
Func<T, Int64> | costFunc | TBD |
Returns
Type | Description |
---|---|
SubFlow<T, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T | TBD |
TMat | TBD |
TClosed | TBD |
See Also
Log<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, String, Func<TOut, Object>, ILoggingAdapter)
Logs elements flowing through the stream as well as completion and erroring.
By default element and completion signals are logged on debug level, and errors are logged on Error level. This can be adjusted according to your needs by providing a custom Attributes.LogLevels attribute on the given Flow.
Emits when the mapping function returns an element
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Log<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, string name, Func<TOut, object> extract = null, ILoggingAdapter log = null)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
String | name | TBD |
Func<TOut, Object> | extract | TBD |
ILoggingAdapter | log | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Merge<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, IGraph<SourceShape<TOut2>, TMat>, Boolean)
Merge the given Source<TOut, TMat> to this IFlow<TOut, TMat>, taking elements as they arrive from input streams, picking randomly when several elements ready.
Emits when one of the inputs has an element available
Backpressures when downstream backpressuresCompletes when all upstreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> Merge<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, IGraph<SourceShape<TOut2>, TMat> other, bool eagerComplete = false)
where TOut1 : TOut2
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut2>, TMat> | other | TBD |
Boolean | eagerComplete | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
MergeMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Int32, Func<TOut1, IGraph<SourceShape<TOut2>, TMat>>)
Transform each input element into a Source<TOut, TMat> of output elements that is
then flattened into the output stream by merging, where at most breadth
substreams are being consumed at any given time.
Emits when a currently consumed substream has an element available
Backpressures when downstream backpressuresCompletes when upstream completes and all consumed substreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> MergeMany<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, int breadth, Func<TOut1, IGraph<SourceShape<TOut2>, TMat>> flatten)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Int32 | breadth | TBD |
Func<TOut1, IGraph<SourceShape<TOut2>, TMat>> | flatten | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
MergeMaterialized<TOut1, TOut2, TMat, TMat2, TMat3, TClosed>(SubFlow<TOut1, TMat, TClosed>, IGraph<SourceShape<TOut2>, TMat2>, Func<TMat, TMat2, TMat3>)
Merge the given Source<TOut, TMat> to this IFlow<TOut, TMat>, taking elements as they arrive from input streams, picking randomly when several elements ready.
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<TOut2, TMat3, TClosed> MergeMaterialized<TOut1, TOut2, TMat, TMat2, TMat3, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, IGraph<SourceShape<TOut2>, TMat2> that, Func<TMat, TMat2, TMat3> combine)
where TOut1 : TOut2
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut2>, TMat2> | that | TBD |
Func<TMat, TMat2, TMat3> | combine | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat3, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TMat2 | TBD |
TMat3 | TBD |
TClosed | TBD |
MergeSorted<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SourceShape<TOut>, TMat>)
Merge the given Source<TOut, TMat> to this IFlow<TOut, TMat>, taking elements as they arrive from input streams, picking always the smallest of the available elements(waiting for one element from each side to be available). This means that possible contiguity of the input streams is not exploited to avoid waiting for elements, this merge will block when one of the inputs does not have more elements(and does not complete).
Emits when one of the inputs has an element available
Backpressures when downstream backpressuresCompletes when all upstreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> MergeSorted<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SourceShape<TOut>, TMat> other)
where TOut : IComparable<TOut>
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut>, TMat> | other | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
MergeSorted<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SourceShape<TOut>, TMat>, IComparer<TOut>)
Merge the given Source<TOut, TMat> to this IFlow<TOut, TMat>, taking elements as they arrive from input streams, picking always the smallest of the available elements(waiting for one element from each side to be available). This means that possible contiguity of the input streams is not exploited to avoid waiting for elements, this merge will block when one of the inputs does not have more elements(and does not complete).
Emits when one of the inputs has an element available
Backpressures when downstream backpressuresCompletes when all upstreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> MergeSorted<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SourceShape<TOut>, TMat> other, IComparer<TOut> comparer)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut>, TMat> | other | TBD |
IComparer<TOut> | comparer | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
MergeSorted<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SourceShape<TOut>, TMat>, Func<TOut, TOut, Int32>)
Merge the given Source<TOut, TMat> to this IFlow<TOut, TMat>, taking elements as they arrive from input streams, picking always the smallest of the available elements(waiting for one element from each side to be available). This means that possible contiguity of the input streams is not exploited to avoid waiting for elements, this merge will block when one of the inputs does not have more elements(and does not complete).
Emits when one of the inputs has an element available
Backpressures when downstream backpressuresCompletes when all upstreams complete
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> MergeSorted<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SourceShape<TOut>, TMat> other, Func<TOut, TOut, int> orderFunc)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut>, TMat> | other | TBD |
Func<TOut, TOut, Int32> | orderFunc | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
OrElse<T, TMat, TClosed>(SubFlow<T, TMat, TClosed>, IGraph<SourceShape<T>, TMat>)
Provides a secondary source that will be consumed if this stream completes without any elements passing by. As soon as the first element comes through this stream, the alternative will be cancelled.
Note that this Flow will be materialized together with the Source<TOut, TMat> and just kept from producing elements by asserting back-pressure until its time comes or it gets cancelled.
On errors the stage is failed regardless of source of the error.
'''Emits when''' element is available from first stream or first stream closed without emitting any elements and an element is available from the second stream
'''Backpressures when''' downstream backpressures
'''Completes when''' the primary stream completes after emitting at least one element, when the primary stream completes without emitting and the secondary stream already has completed or when the secondary stream completes
'''Cancels when''' downstream cancels and additionally the alternative is cancelled as soon as an element passes by from this stream.
Declaration
public static SubFlow<T, TMat, TClosed> OrElse<T, TMat, TClosed>(this SubFlow<T, TMat, TClosed> flow, IGraph<SourceShape<T>, TMat> secondary)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<T>, TMat> | secondary | TBD |
Returns
Type | Description |
---|---|
SubFlow<T, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T | TBD |
TMat | TBD |
TClosed | TBD |
PrefixAndTail<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32)
Takes up to n
elements from the stream and returns a pair containing a strict sequence of the taken element
and a stream representing the remaining elements. If n
is zero or negative, then this will return a pair
of an empty collection and a stream containing the whole upstream unchanged.
Emits when the configured number of prefix elements are available. Emits this prefix, and the rest as a substream
Backpressures when downstream backpressures or substream backpressuresCompletes when prefix elements has been consumed and substream has been consumed
Cancels when downstream cancels or substream cancelsDeclaration
public static SubFlow<(IImmutableList<TOut>, Source<TOut, NotUsed>), TMat, TClosed> PrefixAndTail<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int n)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | n | TBD |
Returns
Type | Description |
---|---|
SubFlow<System.ValueTuple<System.Collections.Immutable.IImmutableList<TOut>, Source<TOut, NotUsed>>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Prepend<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, IGraph<SourceShape<TOut2>, TMat>)
Prepend the given Source<TOut, TMat> to this IFlow<TOut, TMat>, meaning that before elements are generated from this IFlow<TOut, TMat>, the Source's elements will be produced until it is exhausted, at which point Flow elements will start being produced.
Note that this IFlow<TOut, TMat> will be materialized together with the Source<TOut, TMat> and just kept from producing elements by asserting back-pressure until its time comes.
If the given Source<TOut, TMat> gets upstream error - no elements from this IFlow<TOut, TMat> will be pulled.
Emits when element is available from the given Source<TOut, TMat> or from current stream when the Source<TOut, TMat> is completed
Backpressures when downstream backpressures
Completes when this IFlow<TOut, TMat> completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut2, TMat, TClosed> Prepend<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, IGraph<SourceShape<TOut2>, TMat> that)
where TOut1 : TOut2
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<TOut2>, TMat> | that | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Recover<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, Option<TOut>>)
Recover allows to send last element on failure and gracefully complete the stream Since the underlying failure signal onError arrives out-of-band, it might jump over existing elements. This stage can recover the failure signal, but not the skipped elements, which will be dropped.
Throwing an exception inside Recover will be logged on ERROR level automatically.
Emits when element is available from the upstream or upstream is failed and partialFunc
returns an element
Backpressures when downstream backpressures
Completes when upstream completes or upstream failed with exception pf can handle
Cancels when downstream cancelsDeclaration
public static SubFlow<Option<TOut>, TMat, TClosed> Recover<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<Exception, Option<TOut>> partialFunc)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<Exception, Option<TOut>> | partialFunc | TBD |
Returns
Type | Description |
---|---|
SubFlow<Option<TOut>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
RecoverWith<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, IGraph<SourceShape<TOut>, TMat>>)
RecoverWith allows to switch to alternative Source on flow failure. It will stay in effect after
a failure has been recovered so that each time there is a failure it is fed into the partialFunc
and a new
Source may be materialized.
Since the underlying failure signal onError arrives out-of-band, it might jump over existing elements. This stage can recover the failure signal, but not the skipped elements, which will be dropped.
Throwing an exception inside RecoverWith will be logged on ERROR level automatically.Emits when element is available from the upstream or upstream is failed and element is available from alternative Source
Backpressures when downstream backpressures
Completes when upstream completes or upstream failed with exception partialFunc
can handle
Declaration
[Obsolete("Use RecoverWithRetries instead. [1.1.2]")]
public static SubFlow<TOut, TMat, TClosed> RecoverWith<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<Exception, IGraph<SourceShape<TOut>, TMat>> partialFunc)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<Exception, IGraph<SourceShape<TOut>, TMat>> | partialFunc | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
RecoverWithRetries<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, IGraph<SourceShape<TOut>, TMat>>, Int32)
RecoverWithRetries allows to switch to alternative Source on flow failure. It will stay in effect after
a failure has been recovered up to attempts
number of times so that each time there is a failure it is fed into the partialFunc
and a new
Source may be materialized. Note that if you pass in 0, this won't attempt to recover at all. Passing in -1 will behave exactly the same as RecoverWithRetries<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, IGraph<SourceShape<TOut>, TMat>>, Int32).
Since the underlying failure signal onError arrives out-of-band, it might jump over existing elements. This stage can recover the failure signal, but not the skipped elements, which will be dropped.
Throwing an exception inside RecoverWithRetries will be logged on ERROR level automatically.Emits when element is available from the upstream or upstream is failed and element is available from alternative Source
Backpressures when downstream backpressures
Completes when upstream completes or upstream failed with exception partialFunc
can handle
Declaration
public static SubFlow<TOut, TMat, TClosed> RecoverWithRetries<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<Exception, IGraph<SourceShape<TOut>, TMat>> partialFunc, int attempts)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<Exception, IGraph<SourceShape<TOut>, TMat>> | partialFunc | Receives the failure cause and returns the new Source to be materialized if any |
Int32 | attempts | Maximum number of retries or -1 to retry indefinitely |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | if |
Scan<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>)
Similar to Aggregate<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>) but is not a terminal operation,
emits its current value which starts at zero
and then
applies the current and next value to the given function scan
,
emitting the next current value.
If the function scan
throws an exception and the supervision decision is
Restart current value starts at zero
again
the stream will continue.
Emits when the function scanning the element returns a new element
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut2, TMat, TClosed> Scan<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, TOut2 zero, Func<TOut2, TOut1, TOut2> scan)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
TOut2 | zero | TBD |
Func<TOut2, TOut1, TOut2> | scan | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
ScanAsync<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, Task<TOut2>>)
Similar to Scan<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>) but with a asynchronous function,
emits its current value which starts at zero
and then
applies the current and next value to the given function scan
emitting a Task<TResult> that resolves to the next current value.
If the function scan
throws an exception and the supervision decision is
Restart current value starts at zero
again
the stream will continue.
If the function scan
throws an exception and the supervision decision is
Resume current value starts at the previous
current value, or zero when it doesn't have one, and the stream will continue.
Emits the Task<TResult> returned by scan
completes
Completes upstream completes and the last task returned by scan
completes
Declaration
public static SubFlow<TOut2, TMat, TClosed> ScanAsync<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, TOut2 zero, Func<TOut2, TOut1, Task<TOut2>> scan)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
TOut2 | zero | TBD |
Func<TOut2, TOut1, Task<TOut2>> | scan | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Select<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, Func<TIn, TOut>)
Transform this stream by applying the given mapper
function to each of the elements
as they pass through this processing step.
Emits when the mapping function mapper
returns an element
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> Select<TIn, TOut, TMat, TClosed>(this SubFlow<TIn, TMat, TClosed> flow, Func<TIn, TOut> mapper)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TIn, TMat, TClosed> | flow | TBD |
Func<TIn, TOut> | mapper | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
TMat | TBD |
TClosed | TBD |
SelectAsync<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, Int32, Func<TIn, Task<TOut>>)
Transform this stream by applying the given function asyncMapper
to each of the elements
as they pass through this processing step. The function returns a Task<TResult> and the
value of that task will be emitted downstream. The number of tasks
that shall run in parallel is given as the first argument to SelectAsync<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, Int32, Func<TIn, Task<TOut>>).
These tasks may complete in any order, but the elements that
are emitted downstream are in the same order as received from upstream.
If the group by function asyncMapper
throws an exception or if the Task is completed
with failure and the supervision decision is Stop
the stream will be completed with failure.
If the group by function asyncMapper
throws an exception or if the Task is completed
with failure and the supervision decision is Resume or
Restart the element is dropped and the stream continues.
Emits when the task returned by the provided function finishes for the next element in sequence
Backpressures when the number of tasks reaches the configured parallelism and the downstream backpressures or the first task is not completed
Completes when upstream completes and all tasks has been completed and all elements has been emitted
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> SelectAsync<TIn, TOut, TMat, TClosed>(this SubFlow<TIn, TMat, TClosed> flow, int parallelism, Func<TIn, Task<TOut>> asyncMapper)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TIn, TMat, TClosed> | flow | TBD |
Int32 | parallelism | TBD |
Func<TIn, Task<TOut>> | asyncMapper | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
TMat | TBD |
TClosed | TBD |
See Also
| Improve this Doc View SourceSelectAsyncUnordered<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, Int32, Func<TIn, Task<TOut>>)
Transform this stream by applying the given function asyncMapper
to each of the elements
as they pass through this processing step. The function returns a Task and the
value of that task will be emitted downstream. The number of tasks
that shall run in parallel is given as the first argument to SelectAsyncUnordered<TIn, TOut, TMat, TClosed>(SubFlow<TIn, TMat, TClosed>, Int32, Func<TIn, Task<TOut>>).
Each processed element will be emitted dowstream
as soon as it is ready, i.e. it is possible that the elements are not emitted downstream
in the same order as received from upstream.
If the group by function asyncMapper
throws an exception or if the Task is completed
with failure and the supervision decision is Stop
the stream will be completed with failure.
If the group by function asyncMapper
throws an exception or if theTask is completed
with failure and the supervision decision is Resume or
Restart the element is dropped and the stream continues.
Emits when any of the tasks returned by the provided function complete
Backpressures when the number of tasks reaches the configured parallelism and the downstream backpressures
Completes when upstream completes and all tasks has been completed and all elements has been emitted
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> SelectAsyncUnordered<TIn, TOut, TMat, TClosed>(this SubFlow<TIn, TMat, TClosed> flow, int parallelism, Func<TIn, Task<TOut>> asyncMapper)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TIn, TMat, TClosed> | flow | TBD |
Int32 | parallelism | TBD |
Func<TIn, Task<TOut>> | asyncMapper | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TIn | TBD |
TOut | TBD |
TMat | TBD |
TClosed | TBD |
See Also
| Improve this Doc View SourceSelectError<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, Exception>)
While similar to Recover<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, Option<TOut>>) this stage can be used to transform an error signal to a different one without logging it as an error in the process. So in that sense it is NOT exactly equivalent to Recover(e => throw e2) since Recover would log the e2 error.
Since the underlying failure signal onError arrives out-of-band, it might jump over existing elements. This stage can recover the failure signal, but not the skipped elements, which will be dropped.
Similarily to Recover<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<Exception, Option<TOut>>) throwing an exception inside SelectError will be logged.
Emits when element is available from the upstream or upstream is failed and selector
returns an element
Backpressures when downstream backpressures
Completes when upstream completes or upstream failed with exception returned by the selector
Declaration
public static SubFlow<TOut, TMat, TClosed> SelectError<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<Exception, Exception> selector)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<Exception, Exception> | selector | Receives the failure cause and returns the new cause, return the original exception if no other should be applied |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> |
Type Parameters
Name | Description |
---|---|
TOut | |
TMat | |
TClosed |
SelectMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, IEnumerable<TOut2>>)
Transform each input element into a sequence of output elements that is then flattened into the output stream.
The returned sequence MUST NOT contain null values, as they are illegal as stream elements - according to the Reactive Streams specification.
Emits when the mapping function mapConcater
returns an element or there are still remaining elements
from the previously calculated collection
Backpressures when downstream backpressures or there are still remaining elements from the previously calculated collection
Completes when upstream completes and all remaining elements has been emitted
Cancels when downstream cancels
Declaration
public static SubFlow<TOut2, TMat, TClosed> SelectMany<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<TOut1, IEnumerable<TOut2>> mapConcater)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<TOut1, IEnumerable<TOut2>> | mapConcater | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Skip<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64)
Discard the given number of elements at the beginning of the stream.
No elements will be dropped if n
is zero or negative.
Emits when the specified number of elements has been dropped already
Backpressures when the specified number of elements has been dropped and downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Skip<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, long n)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int64 | n | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
SkipWhile<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Predicate<TOut>)
Discard elements at the beginning of the stream while predicate
is true.
All elements will be taken after predicate
returns false first time.
Emits when predicate
returned false and for all following stream elements
predicate
returned false and downstream backpressures
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> SkipWhile<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Predicate<TOut> predicate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Predicate<TOut> | predicate | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
SkipWithin<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
Discard the elements received within the given duration at beginning of the stream.
Emits when the specified time elapsed and a new upstream element arrives
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> SkipWithin<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | duration | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Sliding<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32, Int32)
Apply a sliding window over the stream and return the windows as groups of elements, with the last group possibly smaller than requested due to end-of-stream.
n
must be positive, otherwise IllegalArgumentException is thrown.
step
must be positive, otherwise IllegalArgumentException is thrown.
Emits when enough elements have been collected within the window or upstream completed
Backpressures when a window has been assembled and downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<IEnumerable<TOut>, TMat, TClosed> Sliding<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int n, int step = 1)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | n | TBD |
Int32 | step | TBD |
Returns
Type | Description |
---|---|
SubFlow<IEnumerable<TOut>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when |
StatefulSelectMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<Func<TOut1, IEnumerable<TOut2>>>)
Transform each input element into an Enumerable of output elements that is
then flattened into the output stream. The transformation is meant to be stateful,
which is enabled by creating the transformation function mapConcaterFactory
a new for every materialization —
the returned function will typically close over mutable objects to store state between
invocations. For the stateless variant see SelectMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, IEnumerable<TOut2>>).
The returned Enumerable MUST NOT contain null values, as they are illegal as stream elements - according to the Reactive Streams specification.
Emits when the mapping function returns an element or there are still remaining elements from the previously calculated collection
Backpressures when downstream backpressures or there are still remaining elements from the previously calculated collection
Completes when upstream completes and all remaining elements has been emitted
Cancels when downstream cancels
See also SelectMany<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<TOut1, IEnumerable<TOut2>>)Declaration
public static SubFlow<TOut2, TMat, TClosed> StatefulSelectMany<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<Func<TOut1, IEnumerable<TOut2>>> mapConcaterFactory)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<Func<TOut1, IEnumerable<TOut2>>> | mapConcaterFactory | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
Sum<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TOut, TOut, TOut>)
Similar to Aggregate<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, TOut2, Func<TOut2, TOut1, TOut2>) but uses first element as zero element.
Applies the given function reduce
towards its current and next value,
yielding the next current value.
If the stream is empty (i.e. completes before signaling any elements), the sum stage will fail its downstream with a NoSuchElementException, which is semantically in-line with that standard library collections do in such situations.
Emits when upstream completes
Backpressures when downstream backpressuresCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Sum<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<TOut, TOut, TOut> reduce)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<TOut, TOut, TOut> | reduce | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Take<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64)
Terminate processing (and cancel the upstream publisher) after the given number of elements. Due to input buffering some elements may have been requested from upstream publishers that will then not be processed downstream of this step.
The stream will be completed without producing any elements if n
is zero
or negative.
Emits when the specified number of elements to take has not yet been reached
Backpressures when downstream backpressuresCompletes when the defined number of elements has been taken or upstream completes
Cancels when the defined number of elements has been taken or downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Take<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, long n)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int64 | n | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
TakeWhile<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Predicate<TOut>, Boolean)
Terminate processing (and cancel the upstream publisher) after predicate
returns false for the first time, including the first failed element iff inclusive is true
Due to input buffering some elements may have been requested from upstream publishers
that will then not be processed downstream of this step.
The stream will be completed without producing any elements if predicate
is false for
the first stream element.
Emits when the predicate
is true
Backpressures when downstream backpressures
Completes when predicate
returned false (or 1 after predicate returns false if inclusive
) or upstream completes
Cancels when predicate
returned false or downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> TakeWhile<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Predicate<TOut> predicate, bool inclusive = false)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Predicate<TOut> | predicate | TBD |
Boolean | inclusive | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
TakeWithin<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, TimeSpan)
Terminate processing (and cancel the upstream publisher) after the given duration. Due to input buffering some elements may have been requested from upstream publishers that will then not be processed downstream of this step.
Note that this can be combined with Take<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int64) to limit the number of elements within the duration.
Emits when an upstream element arrives
Backpressures when downstream backpressuresCompletes when upstream completes or timer fires
Cancels when downstream cancels or timer firesDeclaration
public static SubFlow<TOut, TMat, TClosed> TakeWithin<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, TimeSpan duration)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
TimeSpan | duration | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Throttle<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32, TimeSpan, Int32, ThrottleMode)
Sends elements downstream with speed limited to elements
/per
. In other words, this stage set the maximum rate
for emitting messages. This combinator works for streams where all elements have the same cost or length.
Throttle implements the token bucket model. There is a bucket with a given token capacity (burst size or maximumBurst). Tokens drops into the bucket at a given rate and can be "spared" for later use up to bucket capacity to allow some burstiness. Whenever stream wants to send an element, it takes as many tokens from the bucket as number of elements. If there isn't any, throttle waits until the bucket accumulates enough tokens.
Parameter mode
manages behaviour when upstream is faster than throttle rate:
- Shaping makes pauses before emitting messages to meet throttle rate
- Enforcing fails with exception when upstream is faster than throttle rate. Enforcing cannot emit elements that cost more than the maximumBurst
Emits when upstream emits an element and configured time per each element elapsed
Backpressures when downstream backpressures or the incoming rate is higher than the speed limitCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Throttle<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int elements, TimeSpan per, int maximumBurst, ThrottleMode mode)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | elements | TBD |
TimeSpan | per | TBD |
Int32 | maximumBurst | TBD |
ThrottleMode | mode | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when |
Throttle<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Int32, TimeSpan, Int32, Func<TOut, Int32>, ThrottleMode)
Sends elements downstream with speed limited to cost
/per
`. Cost is
calculating for each element individually by calling calculateCost
function.
This combinator works for streams when elements have different cost(length).
Streams of ByteString for example.
Throttle implements the token bucket model. There is a bucket with a given token capacity (burst size or maximumBurst). Tokens drops into the bucket at a given rate and can be spared for later use up to bucket capacity to allow some burstiness. Whenever stream wants to send an element, it takes as many tokens from the bucket as element cost. If there isn't any, throttle waits until the bucket accumulates enough tokens. Elements that costs more than the allowed burst will be delayed proportionally to their cost minus available tokens, meeting the target rate.
Parameter mode
manages behaviour when upstream is faster than throttle rate:
- Shaping makes pauses before emitting messages to meet throttle rate
- Enforcing fails with exception when upstream is faster than throttle rate. Enforcing cannot emit elements that cost more than the maximumBurst
Emits when upstream emits an element and configured time per each element elapsed
Backpressures when downstream backpressures or the incoming rate is higher than the speed limitCompletes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Throttle<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, int cost, TimeSpan per, int maximumBurst, Func<TOut, int> calculateCost, ThrottleMode mode)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Int32 | cost | TBD |
TimeSpan | per | TBD |
Int32 | maximumBurst | TBD |
Func<TOut, Int32> | calculateCost | TBD |
ThrottleMode | mode | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Transform<TOut1, TOut2, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>, Func<IStage<TOut1, TOut2>>)
Generic transformation of a stream with a custom processing IStage<TIn, TOut>. This operator makes it possible to extend the Flow API when there is no specialized operator that performs the transformation.
Declaration
[Obsolete("Use Via(GraphStage) instead. [1.1.2]")]
public static SubFlow<TOut2, TMat, TClosed> Transform<TOut1, TOut2, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow, Func<IStage<TOut1, TOut2>> stageFactory)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow | TBD |
Func<IStage<TOut1, TOut2>> | stageFactory | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut2, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut1 | TBD |
TOut2 | TBD |
TMat | TBD |
TClosed | TBD |
WatchTermination<TOut, TMat, TMat2, TClosed>(SubFlow<TOut, TMat, TClosed>, Func<TMat, Task<Done>, TMat2>)
Materializes to Task<TResult> that completes on getting termination message. The task completes with success when received complete message from upstream or cancel from downstream. It fails with the same error when received error message from downstream.
It is recommended to use the internally optimized Left<TLeft, TRight>(TLeft, TRight) and Right<TLeft, TRight>(TLeft, TRight) combiners where appropriate instead of manually writing functions that pass through one of the values.
Declaration
public static SubFlow<TOut, TMat2, TClosed> WatchTermination<TOut, TMat, TMat2, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Func<TMat, Task<Done>, TMat2> materializerFunction)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Func<TMat, Task<Done>, TMat2> | materializerFunction | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat2, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TMat2 | TBD |
TClosed | TBD |
Where<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Predicate<TOut>)
Only pass on those elements that satisfy the given predicate
.
Emits when the given predicate
returns true for the element
Backpressures when the given predicate
returns true for the element and downstream backpressures
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> Where<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Predicate<TOut> predicate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Predicate<TOut> | predicate | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
WhereNot<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Predicate<TOut>)
Only pass on those elements that NOT satisfy the given predicate
.
Emits when the given predicate
returns true for the element
Backpressures when the given predicate
returns true for the element and downstream backpressures
Completes when upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<TOut, TMat, TClosed> WhereNot<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Predicate<TOut> predicate)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Predicate<TOut> | predicate | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
WireTap<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>)
Attaches the given Sink<TIn, TMat> to this IFlow<TOut, TMat>, as a wire tap, meaning that elements that pass through will also be sent to the wire-tap Sink, without the latter affecting the mainline flow. If the wire-tap Sink backpressures, elements that would've been sent to it will be dropped instead.
It is similar to AlsoTo<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, IGraph<SinkShape<TOut>, TMat>) which does backpressure instead of dropping elements.
Emits when element is available and demand exists from the downstream; the element will also be sent to the wire-tap Sink if there is demand.
Backpressures when downstream backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> WireTap<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, IGraph<SinkShape<TOut>, TMat> that)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | |
IGraph<SinkShape<TOut>, TMat> | that |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> |
Type Parameters
Name | Description |
---|---|
TOut | |
TMat | |
TClosed |
WireTap<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, Action<TOut>)
This is a simplified version of Akka.Streams.Dsl.WireTap<T> that takes only a simple procedure. Elements will be passed into this "side channel" delegate, and any of its results will be ignored.
If the wire-tap operation is slow (it backpressures), elements that would've been sent to it will be dropped instead.
This operation is useful for inspecting the passed through element, usually by means of side-effecting
operations (such as Log
, or emitting metrics), for each element without having to modify it.
For logging signals (elements, completion, error) consider using the Log<TOut, TMat, TClosed>(SubFlow<TOut, TMat, TClosed>, String, Func<TOut, Object>, ILoggingAdapter) stage instead, along with appropriate Attributes.LogLevels.
Emits when upstream emits an element; the same element will be passed to the attached function, as well as to the downstream stage
Backpressures when downstream backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<TOut, TMat, TClosed> WireTap<TOut, TMat, TClosed>(this SubFlow<TOut, TMat, TClosed> flow, Action<TOut> action)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut, TMat, TClosed> | flow | TBD |
Action<TOut> | action | TBD |
Returns
Type | Description |
---|---|
SubFlow<TOut, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
TOut | TBD |
TMat | TBD |
TClosed | TBD |
Zip<T1, T2, TMat, TClosed>(SubFlow<T1, TMat, TClosed>, IGraph<SourceShape<T2>, TMat>)
Combine the elements of current flow and the given Source<TOut, TMat> into a stream of tuples.
Emits when all of the inputs has an element available
Backpressures when downstream backpressuresCompletes when any upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<(T1, T2), TMat, TClosed> Zip<T1, T2, TMat, TClosed>(this SubFlow<T1, TMat, TClosed> flow, IGraph<SourceShape<T2>, TMat> other)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<T2>, TMat> | other | TBD |
Returns
Type | Description |
---|---|
SubFlow<System.ValueTuple<T1, T2>, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T1 | TBD |
T2 | TBD |
TMat | TBD |
TClosed | TBD |
ZipWith<T1, T2, T3, TMat, TClosed>(SubFlow<T1, TMat, TClosed>, IGraph<SourceShape<T2>, TMat>, Func<T1, T2, T3>)
Put together the elements of current flow and the given Source<TOut, TMat> into a stream of combined elements using a combiner function.
Emits when all of the inputs has an element available
Backpressures when downstream backpressuresCompletes when any upstream completes
Cancels when downstream cancelsDeclaration
public static SubFlow<T3, TMat, TClosed> ZipWith<T1, T2, T3, TMat, TClosed>(this SubFlow<T1, TMat, TClosed> flow, IGraph<SourceShape<T2>, TMat> other, Func<T1, T2, T3> combine)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<T1, TMat, TClosed> | flow | TBD |
IGraph<SourceShape<T2>, TMat> | other | TBD |
Func<T1, T2, T3> | combine | TBD |
Returns
Type | Description |
---|---|
SubFlow<T3, TMat, TClosed> | TBD |
Type Parameters
Name | Description |
---|---|
T1 | TBD |
T2 | TBD |
T3 | TBD |
TMat | TBD |
TClosed | TBD |
ZipWithIndex<TOut1, TMat, TClosed>(SubFlow<TOut1, TMat, TClosed>)
Combine the elements of current flow into a stream of tuples consisting of all elements paired with their index. Indices start at 0.
Emits when upstream emits an element and is paired with their index
Backpressures when downstream backpressures
Completes when upstream completes
Cancels when downstream cancels
Declaration
public static SubFlow<(TOut1, long), TMat, TClosed> ZipWithIndex<TOut1, TMat, TClosed>(this SubFlow<TOut1, TMat, TClosed> flow)
Parameters
Type | Name | Description |
---|---|---|
SubFlow<TOut1, TMat, TClosed> | flow |
Returns
Type | Description |
---|---|
SubFlow<System.ValueTuple<TOut1, Int64>, TMat, TClosed> |
Type Parameters
Name | Description |
---|---|
TOut1 | |
TMat | |
TClosed |