Package akka.stream.javadsl
Class Balance
- java.lang.Object
-
- akka.stream.javadsl.Balance
-
public class Balance extends java.lang.Object
Fan-out the stream to several streams. Each upstream element is emitted to the first available downstream consumer. It will not shutdown until the subscriptions for at least two downstream subscribers have been established.'''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''' If eagerCancel is enabled: when any downstream cancels; otherwise: when all downstreams cancel
-
-
Constructor Summary
Constructors Constructor Description Balance()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(int outputCount)
Create a newBalance
operator with the specified input type, bothwaitForAllDownstreams
andeagerCancel
arefalse
.static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(int outputCount, boolean waitForAllDownstreams)
Create a newBalance
operator with the specified input type,eagerCancel
isfalse
.static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(int outputCount, boolean waitForAllDownstreams, boolean eagerCancel)
Create a newBalance
operator with the specified input type.static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(java.lang.Class<T> clazz, int outputCount)
Create a newBalance
operator with the specified input type, bothwaitForAllDownstreams
andeagerCancel
arefalse
.static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(java.lang.Class<T> clazz, int outputCount, boolean waitForAllDownstreams)
Create a newBalance
operator with the specified input type,eagerCancel
isfalse
.static <T> Graph<UniformFanOutShape<T,T>,NotUsed>
create(java.lang.Class<T> clazz, int outputCount, boolean waitForAllDownstreams, boolean eagerCancel)
Create a newBalance
operator with the specified input type.
-
-
-
Method Detail
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(int outputCount, boolean waitForAllDownstreams)
Create a newBalance
operator with the specified input type,eagerCancel
isfalse
.- Parameters:
outputCount
- number of output portswaitForAllDownstreams
- iftrue
it will not start emitting elements to downstream outputs until all of them have requested at least one element
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(int outputCount, boolean waitForAllDownstreams, boolean eagerCancel)
Create a newBalance
operator with the specified input type.- Parameters:
outputCount
- number of output portswaitForAllDownstreams
- iftrue
it will not start emitting elements to downstream outputs until all of them have requested at least one elementeagerCancel
- if true, balance cancels upstream if any of its downstreams cancel, if false, when all have cancelled.
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(int outputCount)
Create a newBalance
operator with the specified input type, bothwaitForAllDownstreams
andeagerCancel
arefalse
.- Parameters:
outputCount
- number of output ports
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(java.lang.Class<T> clazz, int outputCount)
Create a newBalance
operator with the specified input type, bothwaitForAllDownstreams
andeagerCancel
arefalse
.- Parameters:
clazz
- a type hint for this methodoutputCount
- number of output ports
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(java.lang.Class<T> clazz, int outputCount, boolean waitForAllDownstreams)
Create a newBalance
operator with the specified input type,eagerCancel
isfalse
.- Parameters:
clazz
- a type hint for this methodoutputCount
- number of output portswaitForAllDownstreams
- iftrue
it will not start emitting elements to downstream outputs until all of them have requested at least one element
-
create
public static <T> Graph<UniformFanOutShape<T,T>,NotUsed> create(java.lang.Class<T> clazz, int outputCount, boolean waitForAllDownstreams, boolean eagerCancel)
Create a newBalance
operator with the specified input type.- Parameters:
clazz
- a type hint for this methodoutputCount
- number of output portswaitForAllDownstreams
- iftrue
it will not start emitting elements to downstream outputs until all of them have requested at least one elementeagerCancel
- if true, balance cancels upstream if any of its downstreams cancel, if false, when all have cancelled.
-
-