Package org.apache.pekko.stream.scaladsl
Class Partition<T>
java.lang.Object
org.apache.pekko.stream.stage.GraphStageWithMaterializedValue<S,NotUsed>
org.apache.pekko.stream.stage.GraphStage<UniformFanOutShape<T,T>>
org.apache.pekko.stream.scaladsl.Partition<T>
- All Implemented Interfaces:
Graph<UniformFanOutShape<T,
T>, NotUsed>
Fan-out the stream to several streams. emitting an incoming upstream element to one downstream consumer according
to the partitioner function applied to the element
Adheres to the ActorAttributes.SupervisionStrategy
attribute.
'''Emits when''' 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''' all downstreams have cancelled (eagerCancel=false) or one downstream cancels (eagerCancel=true)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
Nested classes/interfaces inherited from interface org.apache.pekko.stream.Graph
Graph.GraphMapMatVal<S extends Shape,
M> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Partition<T>
Create a newPartition
operator with the specified input type.createLogic
(Attributes inheritedAttributes) boolean
in()
out()
int
shape()
The shape of a graph is all that is externally visible: its inlets and outlets.toString()
Methods inherited from class org.apache.pekko.stream.stage.GraphStage
createLogicAndMaterializedValue
Methods inherited from class org.apache.pekko.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 org.apache.pekko.stream.Graph
addAttributes, async, async, async, getAttributes, named
-
Constructor Details
-
Partition
-
-
Method Details
-
apply
Create a newPartition
operator with the specified input type. This method setseagerCancel
tofalse
. To specify a different value for theeagerCancel
parameter, then instantiate Partition using the constructor.If
eagerCancel
is true, partition cancels upstream if any of its downstreams cancel, if false, when all have cancelled.- Parameters:
outputPorts
- number of output portspartitioner
- function deciding which output each element will be targeted
-
outputPorts
public int outputPorts() -
partitioner
-
eagerCancel
public boolean eagerCancel() -
in
-
out
-
shape
Description copied from interface:Graph
The shape of a graph is all that is externally visible: its inlets and outlets. -
createLogic
- Specified by:
createLogic
in classGraphStage<UniformFanOutShape<T,
T>>
-
toString
-