Click or drag to resize
Akka.NETSourceOperationsSplitWhenTOut, TMat Method (SourceTOut, TMat, SubstreamCancelStrategy, FuncTOut, Boolean)
This operation applies the given predicate to all incoming elements and emits them to a stream of output streams, always beginning a new one with the current element if the given predicate returns true for it. This means that for the following series of predicate values, three substreams will be produced with lengths 1, 2, and 3: {{{ false, // element goes into first substream true, false, // elements go into second substream true, false, false // elements go into third substream }}} In case the * first * element of the stream matches the predicate, the first substream emitted by splitWhen will start from that element. For example: {{{ true, false, false // first substream starts from the split-by element true, false // subsequent substreams operate the same way }}} The object returned from this method is not a normal SourceTOut, TMat or FlowTIn, TOut, TMat, it is a SubFlowTOut, TMat, TClosed. This means that after this combinator all transformations are applied to all encountered substreams in the same fashion. Substream mode is exited either by closing the substream (i.e. connecting it to a SinkTIn, TMat) or by merging the substreams back together; see the ToTMat2(IGraphSinkShapeTOut, TMat2) and MergeSubstreams methods on SubFlowTOut, TMat, TClosed for more information. It is important to note that the substreams also propagate back-pressure as any other stream, which means that blocking one substream will block the SplitWhenTOut, TMat(SourceTOut, TMat, SubstreamCancelStrategy, FuncTOut, Boolean) operator itself—and thereby all substreams—once all internal or explicit buffers are filled. If the split predicate throws an exception and the supervision decision is Stop the stream and substreams will be completed with failure. If the split predicate throws an exception and the supervision decision is Resume or Restart the element is dropped and the stream and substreams continue.

Emits when an element for which the provided predicate is true, opening and emitting a new substream for subsequent element

Backpressures when there is an element pending for the next substream, but the previous is not fully consumed yet, or the substream backpressures

Completes when upstream completes

Cancels when downstream cancels and substreams cancel

Namespace:  Akka.Streams.Dsl
Assembly:  Akka.Streams (in Akka.Streams.dll) Version: 1.2.3.42 (1.2.3.42)
Syntax
public static SubFlow<TOut, TMat, IRunnableGraph<TMat>> SplitWhen<TOut, TMat>(
	this Source<TOut, TMat> flow,
	SubstreamCancelStrategy substreamCancelStrategy,
	Func<TOut, bool> predicate
)

Parameters

flow
Type: Akka.Streams.DslSourceTOut, TMat
TBD
substreamCancelStrategy
Type: Akka.StreamsSubstreamCancelStrategy
TBD
predicate
Type: SystemFuncTOut, Boolean
TBD

Type Parameters

TOut
TBD
TMat
TBD

Return Value

Type: SubFlowTOut, TMat, IRunnableGraphTMat
TBD

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SourceTOut, TMat. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also