Class BroadcastHub$
- java.lang.Object
-
- akka.stream.javadsl.BroadcastHub$
-
public class BroadcastHub$ extends java.lang.ObjectA BroadcastHub is a special streaming hub that is able to broadcast streamed elements to a dynamic set of consumers. It consists of two parts, aSinkand aSource. TheSinkbroadcasts elements from a producer to the actually live consumers it has. Once the producer has been materialized, theSinkit feeds into returns a materialized value which is the correspondingSource. ThisSourcecan be materialized an arbitrary number of times, where each of the new materializations will receive their elements from the originalSink.
-
-
Field Summary
Fields Modifier and Type Field Description static BroadcastHub$MODULE$Static reference to the singleton instance of this Scala object.
-
Constructor Summary
Constructors Constructor Description BroadcastHub$()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Sink<T,Source<T,NotUsed>>of(java.lang.Class<T> clazz)Creates aSinkwith default buffer size 256 that receives elements from its upstream producer and broadcasts them to a dynamic set of consumers.<T> Sink<T,Source<T,NotUsed>>of(java.lang.Class<T> clazz, int bufferSize)Creates aSinkthat receives elements from its upstream producer and broadcasts them to a dynamic set of consumers.<T> Sink<T,Source<T,NotUsed>>of(java.lang.Class<T> clazz, int startAfterNrOfConsumers, int bufferSize)Creates aSinkthat receives elements from its upstream producer and broadcasts them to a dynamic set of consumers.
-
-
-
Field Detail
-
MODULE$
public static final BroadcastHub$ MODULE$
Static reference to the singleton instance of this Scala object.
-
-
Method Detail
-
of
public <T> Sink<T,Source<T,NotUsed>> of(java.lang.Class<T> clazz, int bufferSize)
Creates aSinkthat receives elements from its upstream producer and broadcasts them to a dynamic set of consumers. After theSinkreturned by this method is materialized, it returns aSourceas materialized value. ThisSourcecan be materialized an arbitrary number of times and each materialization will receive the broadcast elements from the originalSink.Every new materialization of the
Sinkresults in a new, independent hub, which materializes to its ownSourcefor consuming theSinkof that materialization.If the original
Sinkis failed, then the failure is immediately propagated to all of its materializedSources (possibly jumping over already buffered elements). If the originalSinkis completed, then all correspondingSources are completed. Both failure and normal completion is "remembered" and later materializations of theSourcewill see the same (failure or completion) state.Sources that are cancelled are simply removed from the dynamic set of consumers.- Parameters:
clazz- Type of elements this hub emits and consumesbufferSize- Buffer size used by the producer. Gives an upper bound on how "far" from each other two concurrent consumers can be in terms of element. If the buffer is full, the producer is backpressured. Must be a power of two and less than 4096.
-
of
public <T> Sink<T,Source<T,NotUsed>> of(java.lang.Class<T> clazz, int startAfterNrOfConsumers, int bufferSize)
Creates aSinkthat receives elements from its upstream producer and broadcasts them to a dynamic set of consumers. After theSinkreturned by this method is materialized, it returns aSourceas materialized value. ThisSourcecan be materialized an arbitrary number of times and each materialization will receive the broadcast elements from the originalSink.Every new materialization of the
Sinkresults in a new, independent hub, which materializes to its ownSourcefor consuming theSinkof that materialization.If the original
Sinkis failed, then the failure is immediately propagated to all of its materializedSources (possibly jumping over already buffered elements). If the originalSinkis completed, then all correspondingSources are completed. Both failure and normal completion is "remembered" and later materializations of theSourcewill see the same (failure or completion) state.Sources that are cancelled are simply removed from the dynamic set of consumers.- Parameters:
clazz- Type of elements this hub emits and consumesstartAfterNrOfConsumers- Elements are buffered until this number of consumers have been connected. This is only used initially when the operator is starting up, i.e. it is not honored when consumers have been removed (canceled).bufferSize- Buffer size used by the producer. Gives an upper bound on how "far" from each other two concurrent consumers can be in terms of element. If the buffer is full, the producer is backpressured. Must be a power of two and less than 4096.
-
of
public <T> Sink<T,Source<T,NotUsed>> of(java.lang.Class<T> clazz)
Creates aSinkwith default buffer size 256 that receives elements from its upstream producer and broadcasts them to a dynamic set of consumers. After theSinkreturned by this method is materialized, it returns aSourceas materialized value. ThisSourcecan be materialized an arbitrary number of times and each materialization will receive the broadcast elements from the originalSink.Every new materialization of the
Sinkresults in a new, independent hub, which materializes to its ownSourcefor consuming theSinkof that materialization.If the original
Sinkis failed, then the failure is immediately propagated to all of its materializedSources (possibly jumping over already buffered elements). If the originalSinkis completed, then all correspondingSources are completed. Both failure and normal completion is "remembered" and later materializations of theSourcewill see the same (failure or completion) state.Sources that are cancelled are simply removed from the dynamic set of consumers.- Parameters:
clazz- Type of elements this hub emits and consumes
-
-