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 classstatic classNested 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 newPartitionoperator with the specified input type.createLogic(Attributes inheritedAttributes) booleanin()out()intshape()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
createLogicAndMaterializedValueMethods inherited from class org.apache.pekko.stream.stage.GraphStageWithMaterializedValue
initialAttributes, withAttributesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.stream.Graph
addAttributes, async, async, async, getAttributes, named
-
Constructor Details
-
Partition
-
-
Method Details
-
apply
Create a newPartitionoperator with the specified input type. This method setseagerCanceltofalse. To specify a different value for theeagerCancelparameter, then instantiate Partition using the constructor.If
eagerCancelis 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:GraphThe shape of a graph is all that is externally visible: its inlets and outlets. -
createLogic
- Specified by:
createLogicin classGraphStage<UniformFanOutShape<T,T>>
-
toString
-