public final class Balance<T> extends GraphStage<UniformFanOutShape<T,T>>
A Balance
has one in
port and 2 or more out
ports.
'''Emits when''' any of the outputs stops backpressuring; emits the element to the first available output
'''Backpressures when''' all of the outputs backpressure
'''Completes when''' upstream completes
'''Cancels when''' all downstreams cancel
Constructor and Description |
---|
Balance(int outputPorts,
boolean waitForAllDownstreams) |
Modifier and Type | Method and Description |
---|---|
static Graph<S,M> |
addAttributes(Attributes attr) |
static <T> Balance<T> |
apply(int outputPorts,
boolean waitForAllDownstreams)
Create a new
Balance with the specified number of output ports. |
static Graph<S,M> |
async() |
GraphStageLogic |
createLogic(Attributes inheritedAttributes) |
static scala.Tuple2<GraphStageLogic,NotUsed> |
createLogicAndMaterializedValue(Attributes inheritedAttributes) |
Inlet<T> |
in() |
Attributes |
initialAttributes() |
static StreamLayout.Module |
module() |
static Graph<S,M> |
named(java.lang.String name) |
scala.collection.immutable.IndexedSeq<Outlet<T>> |
out() |
int |
outputPorts() |
UniformFanOutShape<T,T> |
shape()
The shape of a graph is all that is externally visible: its inlets and outlets.
|
java.lang.String |
toString() |
boolean |
waitForAllDownstreams() |
static Graph<S,M> |
withAttributes(Attributes attr) |
createLogicAndMaterializedValue
module, withAttributes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAttributes, async, named
public static <T> Balance<T> apply(int outputPorts, boolean waitForAllDownstreams)
Balance
with the specified number of output ports.
outputPorts
- number of output portswaitForAllDownstreams
- if you use waitForAllDownstreams = true
it will not start emitting
elements to downstream outputs until all of them have requested at least one element,
default value is false
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 outputPorts()
public boolean waitForAllDownstreams()
public Attributes initialAttributes()
initialAttributes
in class GraphStageWithMaterializedValue<UniformFanOutShape<T,T>,NotUsed>
public UniformFanOutShape<T,T> shape()
Graph
public GraphStageLogic createLogic(Attributes inheritedAttributes)
createLogic
in class GraphStage<UniformFanOutShape<T,T>>
public java.lang.String toString()
toString
in class java.lang.Object