Class MergeSequence<T>
- java.lang.Object
-
- akka.stream.stage.GraphStageWithMaterializedValue<S,NotUsed>
-
- akka.stream.stage.GraphStage<UniformFanInShape<T,T>>
-
- akka.stream.scaladsl.MergeSequence<T>
-
- All Implemented Interfaces:
Graph<UniformFanInShape<T,T>,NotUsed>
public final class MergeSequence<T> extends GraphStage<UniformFanInShape<T,T>>
Takes multiple streams whose elements in aggregate have a defined linear sequence with difference 1, starting at 0, and outputs a single stream containing these elements, in order. That is, given a set of input streams with combined elements *ek*:*e0*, *e1*, *e2*, ..., *en*
This will output a stream ordered by *k*.
The elements in the input streams must already be sorted according to the sequence. The input streams do not need to be linear, but the aggregate stream must be linear, no element *k* may be skipped or duplicated, either of these conditions will cause the stream to fail.
The typical use case for this is to merge a partitioned stream back together while maintaining order. This can be achieved by first using
zipWithIndex
on the input stream, then partitioning using aPartition
fanout, and then maintaining the index through the processing of each partition before bringing together with this stage.'''Emits when''' one of the upstreams has the next expected element in the sequence available.
'''Backpressures when''' downstream backpressures
'''Completes when''' all upstreams complete
'''Cancels when''' downstream cancels
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.stream.Graph
Graph.GraphMapMatVal<S extends Shape,M>
-
-
Constructor Summary
Constructors Constructor Description MergeSequence(int inputPorts, scala.Function1<T,java.lang.Object> extractSequence)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Graph<UniformFanInShape<T,T>,NotUsed>
apply(int inputPorts, scala.Function1<T,java.lang.Object> extractSequence)
static <T> int
apply$default$1()
GraphStageLogic
createLogic(Attributes inheritedAttributes)
int
inputPorts()
UniformFanInShape<T,T>
shape()
The shape of a graph is all that is externally visible: its inlets and outlets.java.lang.String
toString()
-
Methods inherited from class akka.stream.stage.GraphStage
createLogicAndMaterializedValue
-
Methods inherited from class akka.stream.stage.GraphStageWithMaterializedValue
initialAttributes, withAttributes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.stream.Graph
addAttributes, async, async, async, getAttributes, named
-
-
-
-
Constructor Detail
-
MergeSequence
public MergeSequence(int inputPorts, scala.Function1<T,java.lang.Object> extractSequence)
-
-
Method Detail
-
apply
public static <T> Graph<UniformFanInShape<T,T>,NotUsed> apply(int inputPorts, scala.Function1<T,java.lang.Object> extractSequence)
-
apply$default$1
public static <T> int apply$default$1()
-
inputPorts
public int inputPorts()
-
shape
public UniformFanInShape<T,T> shape()
Description copied from interface:Graph
The shape of a graph is all that is externally visible: its inlets and outlets.
-
createLogic
public GraphStageLogic createLogic(Attributes inheritedAttributes)
- Specified by:
createLogic
in classGraphStage<UniformFanInShape<T,T>>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-