Package akka.stream.scaladsl
Class MergePreferred<T>
- java.lang.Object
-
- akka.stream.stage.GraphStageWithMaterializedValue<S,NotUsed>
-
- akka.stream.stage.GraphStage<MergePreferred.MergePreferredShape<T>>
-
- akka.stream.scaladsl.MergePreferred<T>
-
- All Implemented Interfaces:
Graph<MergePreferred.MergePreferredShape<T>,NotUsed>
public final class MergePreferred<T> extends GraphStage<MergePreferred.MergePreferredShape<T>>
Merge several streams, taking elements as they arrive from input streams (picking from preferred when several have elements ready).A
MergePreferredhas oneoutport, onepreferredinput port and 1 or more secondaryinports.'''Emits when''' one of the inputs has an element available, preferring a specified input if multiple have elements available
'''Backpressures when''' downstream backpressures
'''Completes when''' all upstreams complete (eagerComplete=false) or one upstream completes (eagerComplete=true), default value is
false'''Cancels when''' downstream cancels
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMergePreferred.MergePreferredShape<T>-
Nested classes/interfaces inherited from interface akka.stream.Graph
Graph.GraphMapMatVal<S extends Shape,M>
-
-
Constructor Summary
Constructors Constructor Description MergePreferred(int secondaryPorts, boolean eagerComplete)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> MergePreferred<T>apply(int secondaryPorts, boolean eagerComplete)Create a newMergePreferredwith the specified number of secondary input ports.static <T> booleanapply$default$2()GraphStageLogiccreateLogic(Attributes inheritedAttributes)booleaneagerComplete()Inlet<T>in(int id)AttributesinitialAttributes()Outlet<T>out()Inlet<T>preferred()intsecondaryPorts()MergePreferred.MergePreferredShape<T>shape()The shape of a graph is all that is externally visible: its inlets and outlets.-
Methods inherited from class akka.stream.stage.GraphStage
createLogicAndMaterializedValue
-
Methods inherited from class akka.stream.stage.GraphStageWithMaterializedValue
withAttributes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.stream.Graph
addAttributes, async, async, async, getAttributes, named
-
-
-
-
Method Detail
-
apply
public static <T> MergePreferred<T> apply(int secondaryPorts, boolean eagerComplete)
Create a newMergePreferredwith the specified number of secondary input ports.- Parameters:
secondaryPorts- number of secondary input portseagerComplete- if true, the merge will complete as soon as one of its inputs completes.
-
apply$default$2
public static <T> boolean apply$default$2()
-
secondaryPorts
public int secondaryPorts()
-
eagerComplete
public boolean eagerComplete()
-
initialAttributes
public Attributes initialAttributes()
- Overrides:
initialAttributesin classGraphStageWithMaterializedValue<MergePreferred.MergePreferredShape<T>,NotUsed>
-
shape
public MergePreferred.MergePreferredShape<T> shape()
Description copied from interface:GraphThe shape of a graph is all that is externally visible: its inlets and outlets.
-
createLogic
public GraphStageLogic createLogic(Attributes inheritedAttributes)
- Specified by:
createLogicin classGraphStage<MergePreferred.MergePreferredShape<T>>
-
-