Package akka.stream.scaladsl
Class BroadcastHub<T>
- java.lang.Object
-
- akka.stream.stage.GraphStageWithMaterializedValue<SinkShape<T>,Source<T,NotUsed>>
-
- akka.stream.scaladsl.BroadcastHub<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceBroadcastHub.ConsumerEventstatic interfaceBroadcastHub.HubEventstatic interfaceBroadcastHub.HubState
-
Constructor Summary
Constructors Constructor Description BroadcastHub(int bufferSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.Tuple2<GraphStageLogic,Source<T,NotUsed>>createLogicAndMaterializedValue(Attributes inheritedAttributes)Inlet<T>in()SinkShape<T>shape()The shape of a graph is all that is externally visible: its inlets and outlets.static <T> Sink<T,Source<T,NotUsed>>sink()Creates aSinkthat receives elements from its upstream producer and broadcasts them to a dynamic set of consumers.static <T> Sink<T,Source<T,NotUsed>>sink(int bufferSize)-
Methods inherited from class akka.stream.stage.GraphStageWithMaterializedValue
createLogicAndMaterializedValue, initialAttributes, traversalBuilder, withAttributes
-
-
-
-
Method Detail
-
sink
public static <T> Sink<T,Source<T,NotUsed>> sink()
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 arbitrary many 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.- Returns:
- (undocumented)
-
shape
public SinkShape<T> shape()
Description copied from interface:GraphThe shape of a graph is all that is externally visible: its inlets and outlets.- Returns:
- (undocumented)
-
createLogicAndMaterializedValue
public scala.Tuple2<GraphStageLogic,Source<T,NotUsed>> createLogicAndMaterializedValue(Attributes inheritedAttributes)
- Specified by:
createLogicAndMaterializedValuein classGraphStageWithMaterializedValue<SinkShape<T>,Source<T,NotUsed>>
-
-