Class BroadcastHub
A BroadcastHub is a special streaming hub that is able to broadcast streamed elements to a dynamic set of consumers. It consists of two parts, a Sink<TIn, TMat> and a Source<TOut, TMat>. The Sink<TIn, TMat> broadcasts elements from a producer to the actually live consumers it has. Once the producer has been materialized, the Sink<TIn, TMat> it feeds into returns a materialized value which is the corresponding Source<TOut, TMat>. This Source<TOut, TMat> can be materialized arbitrary many times, where each of the new materializations will receive their elements from the original Sink<TIn, TMat>.
Inherited Members
Namespace: Akka.Streams.Dsl
Assembly: Akka.Streams.dll
Syntax
public class BroadcastHub
Methods
| Improve this Doc View SourceSink<T>()
Creates a Sink<TIn, TMat> that receives elements from its upstream producer and broadcasts them to a dynamic set of consumers. After the Sink<TIn, TMat> returned by this method is materialized, it returns a Source<TOut, TMat> as materialized value. This Source<TOut, TMat> can be materialized arbitrary many times and each materialization will receive the broadcast elements from the original Sink<TIn, TMat>.
Every new materialization of the Sink<TIn, TMat> results in a new, independent hub, which materializes to its own Source<TOut, TMat> for consuming the Sink<TIn, TMat> of that materialization.
If the original Sink<TIn, TMat> is failed, then the failure is immediately propagated to all of its materialized Source<TOut, TMat>s (possibly jumping over already buffered elements). If the original Sink<TIn, TMat> is completed, then all corresponding Source<TOut, TMat>s are completed. Both failure and normal completion is "remembered" and later materializations of the Source<TOut, TMat> will see the same (failure or completion) state. Source<TOut, TMat>s that are cancelled are simply removed from the dynamic set of consumers.
Declaration
public static Sink<T, Source<T, NotUsed>> Sink<T>()
Returns
Type | Description |
---|---|
Sink<T, Source<T, NotUsed>> | TBD |
Type Parameters
Name | Description |
---|---|
T | TBD |
Sink<T>(Int32)
Creates a Sink<TIn, TMat> that receives elements from its upstream producer and broadcasts them to a dynamic set of consumers. After the Sink<TIn, TMat> returned by this method is materialized, it returns a Source<TOut, TMat> as materialized value. This Source<TOut, TMat> can be materialized arbitrary many times and each materialization will receive the broadcast elements from the original Sink<TIn, TMat>.
Every new materialization of the Sink<TIn, TMat> results in a new, independent hub, which materializes to its own Source<TOut, TMat> for consuming the Sink<TIn, TMat> of that materialization.
If the original Sink<TIn, TMat> is failed, then the failure is immediately propagated to all of its materialized Source<TOut, TMat>s (possibly jumping over already buffered elements). If the original Sink<TIn, TMat> is completed, then all corresponding Source<TOut, TMat>s are completed. Both failure and normal completion is "remembered" and later materializations of the Source<TOut, TMat> will see the same (failure or completion) state. Source<TOut, TMat>s that are cancelled are simply removed from the dynamic set of consumers.
Declaration
public static Sink<T, Source<T, NotUsed>> Sink<T>(int bufferSize)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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. |
Returns
Type | Description |
---|---|
Sink<T, Source<T, NotUsed>> | TBD |
Type Parameters
Name | Description |
---|---|
T | TBD |