public class BroadcastProcessor<T> extends AbstractMulti<T> implements org.reactivestreams.Processor<T,T>
Processor
that broadcast all subsequently observed items to its current
Subscriber
s.
This processor does not coordinate back-pressure between different subscribers and between the upstream source and a
subscriber. If an upstream item is received via onNext(Object)
, if a subscriber is not ready to receive that
item, that subscriber is terminated via a BackPressureFailure
.
The BroadcastProcessor
's Subscriber
-side consumes items in an unbounded manner.
When this BroadcastProcessor
is terminated via onError(Throwable)
or onComplete()
, late
Subscriber
s only receive the respective terminal event.
Unlike the UnicastProcessor
, a BroadcastProcessor
doesn't retain/cache items, therefore, a new
Subscriber
won't receive any past items.
Even though BroadcastProcessor
implements the Subscriber
interface, calling onSubscribe
is
not required if the processor is used as a standalone source. However, calling onSubscribe
after
the BroadcastProcessor
has failed or reached completion results in the given Subscription
being
canceled immediately.
Modifier and Type | Method and Description |
---|---|
static <T> BroadcastProcessor<T> |
create()
Creates a new
BroadcastProcessor |
void |
onComplete() |
void |
onError(Throwable failure) |
void |
onNext(T item) |
void |
onSubscribe(org.reactivestreams.Subscription subscription) |
SerializedProcessor<T,T> |
serialized() |
void |
subscribe(MultiSubscriber<? super T> downstream) |
broadcast, cache, collectItems, convert, emitOn, groupItems, on, onCancellation, onCompletion, onFailure, onFailure, onFailure, onItem, onOverflow, onRequest, onSubscribe, onTermination, runSubscriptionOn, subscribe, subscribe, toUni, transform
public static <T> BroadcastProcessor<T> create()
BroadcastProcessor
T
- the type of itemBroadcastProcessor
public SerializedProcessor<T,T> serialized()
public void subscribe(MultiSubscriber<? super T> downstream)
subscribe
in class AbstractMulti<T>
public void onSubscribe(org.reactivestreams.Subscription subscription)
onSubscribe
in interface org.reactivestreams.Subscriber<T>
public void onNext(T item)
onNext
in interface org.reactivestreams.Subscriber<T>
public void onError(Throwable failure)
onError
in interface org.reactivestreams.Subscriber<T>
public void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<T>
Copyright © 2019–2020 SmallRye. All rights reserved.