Class BroadcastProcessor<T>
- java.lang.Object
-
- io.smallrye.mutiny.operators.AbstractMulti<T>
-
- io.smallrye.mutiny.operators.multi.processors.BroadcastProcessor<T>
-
- All Implemented Interfaces:
Multi<T>
,org.reactivestreams.Processor<T,T>
,org.reactivestreams.Publisher<T>
,org.reactivestreams.Subscriber<T>
public class BroadcastProcessor<T> extends AbstractMulti<T> implements org.reactivestreams.Processor<T,T>
Implementation ofProcessor
that broadcast all subsequently observed items to its currentSubscriber
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 aBackPressureFailure
.The
BroadcastProcessor
'sSubscriber
-side consumes items in an unbounded manner.When this
BroadcastProcessor
is terminated viaonError(Throwable)
oronComplete()
, lateSubscriber
s only receive the respective terminal event.Unlike the
UnicastProcessor
, aBroadcastProcessor
doesn't retain/cache items, therefore, a newSubscriber
won't receive any past items.Even though
BroadcastProcessor
implements theSubscriber
interface, callingonSubscribe
is not required if the processor is used as a standalone source. However, callingonSubscribe
after theBroadcastProcessor
has failed or reached completion results in the givenSubscription
being canceled immediately.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> BroadcastProcessor<T>
create()
Creates a newBroadcastProcessor
void
onComplete()
void
onError(java.lang.Throwable failure)
void
onNext(T item)
void
onSubscribe(org.reactivestreams.Subscription subscription)
SerializedProcessor<T,T>
serialized()
void
subscribe(MultiSubscriber<? super T> downstream)
-
Methods inherited from class io.smallrye.mutiny.operators.AbstractMulti
broadcast, cache, collect, convert, emitOn, group, ifNoItem, log, log, onCancellation, onCompletion, onFailure, onFailure, onFailure, onItem, onOverflow, onRequest, onSubscribe, onSubscription, onTermination, runSubscriptionOn, select, skip, subscribe, subscribe, toHotStream, toUni, withContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
create
public static <T> BroadcastProcessor<T> create()
Creates a newBroadcastProcessor
- Type Parameters:
T
- the type of item- Returns:
- the new
BroadcastProcessor
-
serialized
public SerializedProcessor<T,T> serialized()
-
subscribe
public void subscribe(MultiSubscriber<? super T> downstream)
- Overrides:
subscribe
in classAbstractMulti<T>
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription subscription)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public void onNext(T item)
- Specified by:
onNext
in interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(java.lang.Throwable failure)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<T>
-
-