Constructor and Description |
---|
BroadcastHub(int bufferSize) |
Modifier and Type | Method and Description |
---|---|
static Graph<S,M> |
addAttributes(Attributes attr) |
static Graph<S,M> |
async() |
scala.Tuple2<GraphStageLogic,Source<T,NotUsed>> |
createLogicAndMaterializedValue(Attributes inheritedAttributes) |
Inlet<T> |
in() |
protected static Attributes |
initialAttributes() |
static StreamLayout.Module |
module() |
static Graph<S,M> |
named(java.lang.String name) |
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 a
Sink that 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)
Creates a
Sink that receives elements from its upstream producer and broadcasts them to a dynamic set
of consumers. |
static Graph<S,M> |
withAttributes(Attributes attr) |
initialAttributes, module, withAttributes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAttributes, async, named
public static <T> Sink<T,Source<T,NotUsed>> sink(int bufferSize)
Sink
that receives elements from its upstream producer and broadcasts them to a dynamic set
of consumers. After the Sink
returned by this method is materialized, it returns a Source
as materialized
value. This Source
can be materialized arbitrary many times and each materialization will receive the
broadcast elements form the ofiginal Sink
.
Every new materialization of the Sink
results in a new, independent hub, which materializes to its own
Source
for consuming the Sink
of that materialization.
If the original Sink
is failed, then the failure is immediately propagated to all of its materialized
Source
s (possibly jumping over already buffered elements). If the original Sink
is completed, then
all corresponding Source
s are completed. Both failure and normal completion is "remembered" and later
materializations of the Source
will see the same (failure or completion) state. Source
s that are
cancelled are simply removed from the dynamic set of consumers.
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 this buffer is full, the producer
is backpressured. Must be a power of two and less than 4096.public static <T> Sink<T,Source<T,NotUsed>> sink()
Sink
that receives elements from its upstream producer and broadcasts them to a dynamic set
of consumers. After the Sink
returned by this method is materialized, it returns a Source
as materialized
value. This Source
can be materialized arbitrary many times and each materialization will receive the
broadcast elements form the ofiginal Sink
.
Every new materialization of the Sink
results in a new, independent hub, which materializes to its own
Source
for consuming the Sink
of that materialization.
If the original Sink
is failed, then the failure is immediately propagated to all of its materialized
Source
s (possibly jumping over already buffered elements). If the original Sink
is completed, then
all corresponding Source
s are completed. Both failure and normal completion is "remembered" and later
materializations of the Source
will see the same (failure or completion) state. Source
s that are
cancelled are simply removed from the dynamic set of consumers.
public static Graph<S,M> named(java.lang.String name)
public static Graph<S,M> async()
public static Graph<S,M> addAttributes(Attributes attr)
protected static Attributes initialAttributes()
public static final StreamLayout.Module module()
public static final Graph<S,M> withAttributes(Attributes attr)
public SinkShape<T> shape()
Graph
public scala.Tuple2<GraphStageLogic,Source<T,NotUsed>> createLogicAndMaterializedValue(Attributes inheritedAttributes)
createLogicAndMaterializedValue
in class GraphStageWithMaterializedValue<SinkShape<T>,Source<T,NotUsed>>