public class Broadcaster<O> extends Action<O,O>
Broadcaster
is a subclass of Stream
which exposes methods for publishing values into the pipeline.
It is possible to publish discreet values typed to the generic type of the Stream
as well as error conditions
and the Reactive Streams "complete" signal via the onComplete()
method.Modifier and Type | Field and Description |
---|---|
protected Dispatcher |
dispatcher |
protected Environment |
environment |
static org.reactivestreams.Subscription |
HOT_SUBSCRIPTION |
capacity, downstreamSubscription, NO_CAPACITY, RESERVED_SLOTS, upstreamSubscription
Modifier | Constructor and Description |
---|---|
protected |
Broadcaster(Environment environment,
Dispatcher dispatcher,
long capacity)
INTERNAL
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Stop consuming signals from upstream.
|
Broadcaster<O> |
capacity(long elements)
--------------------------------------------------------------------------------------------------------
ACTION MODIFIERS
--------------------------------------------------------------------------------------------------------
|
static <T> Broadcaster<T> |
create()
Build a Broadcaster, ready to broadcast values with
.Broadcaster#onNext(Object) ,
onError(Throwable) , onComplete() . |
static <T> Broadcaster<T> |
create(Dispatcher dispatcher)
Build a Broadcaster, ready to broadcast values with
Action.onNext(Object) ,
onError(Throwable) , onComplete() . |
static <T> Broadcaster<T> |
create(Environment env)
Build a Broadcaster, ready to broadcast values with
onNext(Object) ,
onError(Throwable) , onComplete() . |
static <T> Broadcaster<T> |
create(Environment env,
Dispatcher dispatcher)
|
protected PushSubscription<O> |
createSubscription(org.reactivestreams.Subscriber<? super O> subscriber,
boolean reactivePull) |
protected PushSubscription<O> |
createSubscription(org.reactivestreams.Subscriber<? super O> subscriber,
CompletableQueue<O> queue) |
protected void |
doNext(O ev) |
Dispatcher |
getDispatcher()
Get the dispatcher used to execute signals on this Stream instance.
|
void |
onComplete() |
void |
onError(Throwable cause) |
void |
onNext(O ev) |
void |
onSubscribe(org.reactivestreams.Subscription subscription) |
void |
recycle()
Free any internal resources and reset the state of the object to enable reuse.
|
protected void |
requestUpstream(long capacity,
boolean terminated,
long elements) |
protected void |
subscribeWithSubscription(org.reactivestreams.Subscriber<? super O> subscriber,
PushSubscription<O> subscription)
Subscribe a given subscriber and pairs it with a given subscription instead of letting the Stream pick it
automatically.
|
accept, addSubscription, broadcastComplete, broadcastError, broadcastNext, cancelSubscription, checkRequest, combine, control, createTrackingSubscription, debug, doComplete, doError, doOnSubscribe, doShutdown, doStart, downstreamSubscription, evaluateCapacity, findOldestUpstream, getCapacity, getSubscription, isPublishing, onOverflowBuffer, requestAll, requestMore, subscribe, toBroadcastCompleteConsumer, toBroadcastErrorConsumer, toBroadcastNextConsumer, toString
adaptiveConsume, adaptiveConsumeOn, after, batchConsume, batchConsumeOn, broadcast, broadcastOn, broadcastTo, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, cache, cast, concatMap, concatWith, consume, consume, consume, consume, consume, consumeLater, consumeOn, consumeOn, consumeOn, count, count, decode, defaultIfEmpty, dematerialize, dispatchOn, dispatchOn, dispatchOn, distinct, distinct, distinctUntilChanged, distinctUntilChanged, elapsed, elementAt, elementAtOrDefault, encode, env, exists, fanIn, filter, filter, finallyDo, flatMap, getEnvironment, getTimer, groupBy, ignoreError, ignoreError, isReactivePull, join, joinWith, keepAlive, last, lift, log, log, map, materialize, merge, mergeWith, nest, next, observe, observeCancel, observeComplete, observeError, observeStart, observeSubscribe, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onErrorReturn, onOverflowBuffer, onOverflowDrop, partition, partition, process, recover, reduce, reduce, repeat, repeat, repeatWhen, requestWhen, retry, retry, retry, retry, retryWhen, sample, sample, sample, sample, sample, sample, sampleFirst, sampleFirst, sampleFirst, sampleFirst, sampleFirst, sampleFirst, scan, scan, skip, skip, skip, skipWhile, skipWhile, sort, sort, sort, sort, split, split, startWith, startWith, startWith, subscribe, subscribeOn, subscribeOn, subscribeOn, switchMap, take, take, take, takeWhile, tap, throttle, throttle, timeout, timeout, timeout, timeout, timestamp, toBlockingQueue, toBlockingQueue, toList, toList, unbounded, when, window, window, window, window, window, window, window, window, window, window, window, zip, zipWith, zipWith
public static final org.reactivestreams.Subscription HOT_SUBSCRIPTION
protected final Dispatcher dispatcher
protected final Environment environment
protected Broadcaster(Environment environment, Dispatcher dispatcher, long capacity)
public static <T> Broadcaster<T> create()
.Broadcaster#onNext(Object)
,
onError(Throwable)
, onComplete()
.
Values broadcasted are directly consumable by subscribing to the returned instance.T
- the type of values passing through the BroadcasterBroadcaster
public static <T> Broadcaster<T> create(Environment env)
onNext(Object)
,
onError(Throwable)
, onComplete()
.
Values broadcasted are directly consumable by subscribing to the returned instance.T
- the type of values passing through the Broadcasterenv
- the Reactor Environment
to useBroadcaster
public static <T> Broadcaster<T> create(Dispatcher dispatcher)
Action.onNext(Object)
,
onError(Throwable)
, onComplete()
.
Values broadcasted are directly consumable by subscribing to the returned instance.T
- the type of values passing through the Broadcasterdispatcher
- the Dispatcher
to useBroadcaster
public static <T> Broadcaster<T> create(Environment env, Dispatcher dispatcher)
(Object)
,
onError(Throwable)
, onComplete()
.
Values broadcasted are directly consumable by subscribing to the returned instance.T
- the type of values passing through the Streamenv
- the Reactor Environment
to usedispatcher
- the Dispatcher
to useBroadcaster
public final Dispatcher getDispatcher()
Stream
getDispatcher
in class Stream<O>
public void onNext(O ev)
public void onSubscribe(org.reactivestreams.Subscription subscription)
onSubscribe
in interface org.reactivestreams.Subscriber<O>
onSubscribe
in class Action<O,O>
public void onError(Throwable cause)
public void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<O>
onComplete
in class Action<O,O>
protected PushSubscription<O> createSubscription(org.reactivestreams.Subscriber<? super O> subscriber, CompletableQueue<O> queue)
createSubscription
in class Action<O,O>
protected PushSubscription<O> createSubscription(org.reactivestreams.Subscriber<? super O> subscriber, boolean reactivePull)
createSubscription
in class Action<O,O>
protected void subscribeWithSubscription(org.reactivestreams.Subscriber<? super O> subscriber, PushSubscription<O> subscription)
Action
This is mainly useful for libraries implementors, usually this#lift(reactor.fn.Supplier)
and
this#subscribe(org.reactivestreams.Subscriber)
are just fine.
subscribeWithSubscription
in class Action<O,O>
public void cancel()
Control
PushSubscription.terminated
flag.public void recycle()
Recyclable
public Broadcaster<O> capacity(long elements)
Action
protected void requestUpstream(long capacity, boolean terminated, long elements)
requestUpstream
in class Action<O,O>
Copyright © 2017. All rights reserved.