public final class MergePreferred<T> extends GraphStage<MergePreferred.MergePreferredShape<T>>
A MergePreferred
has one out
port, one preferred
input port and 0 or more secondary in
ports.
'''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
A Broadcast
has one in
port and 2 or more out
ports.
Modifier and Type | Class and Description |
---|---|
static class |
MergePreferred.MergePreferredShape<T> |
Constructor and Description |
---|
MergePreferred(int secondaryPorts,
boolean eagerComplete) |
Modifier and Type | Method and Description |
---|---|
static Graph<S,M> |
addAttributes(Attributes attr) |
static <T> MergePreferred<T> |
apply(int secondaryPorts,
boolean eagerComplete)
Create a new
MergePreferred with the specified number of secondary input ports. |
static Graph<S,M> |
async() |
GraphStageLogic |
createLogic(Attributes inheritedAttributes) |
static scala.Tuple2<GraphStageLogic,NotUsed> |
createLogicAndMaterializedValue(Attributes inheritedAttributes) |
boolean |
eagerComplete() |
Inlet<T> |
in(int id) |
Attributes |
initialAttributes() |
static StreamLayout.Module |
module() |
static Graph<S,M> |
named(java.lang.String name) |
Outlet<T> |
out() |
Inlet<T> |
preferred() |
int |
secondaryPorts() |
MergePreferred.MergePreferredShape<T> |
shape()
The shape of a graph is all that is externally visible: its inlets and outlets.
|
static Graph<S,M> |
withAttributes(Attributes attr) |
createLogicAndMaterializedValue
module, withAttributes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttributes, async, named
public static <T> MergePreferred<T> apply(int secondaryPorts, boolean eagerComplete)
MergePreferred
with the specified number of secondary input ports.
secondaryPorts
- number of secondary input portseagerComplete
- if true, the merge will complete as soon as one of its inputs completes.public static Graph<S,M> named(java.lang.String name)
public static Graph<S,M> async()
public static Graph<S,M> addAttributes(Attributes attr)
public static final StreamLayout.Module module()
public static final Graph<S,M> withAttributes(Attributes attr)
public static final scala.Tuple2<GraphStageLogic,NotUsed> createLogicAndMaterializedValue(Attributes inheritedAttributes)
public int secondaryPorts()
public boolean eagerComplete()
public Attributes initialAttributes()
initialAttributes
in class GraphStageWithMaterializedValue<MergePreferred.MergePreferredShape<T>,NotUsed>
public MergePreferred.MergePreferredShape<T> shape()
Graph
public GraphStageLogic createLogic(Attributes inheritedAttributes)
createLogic
in class GraphStage<MergePreferred.MergePreferredShape<T>>