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 ofProcessorthat broadcast all subsequently observed items to its currentSubscribers.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
BroadcastProcessoris terminated viaonError(Throwable)oronComplete(), lateSubscribers only receive the respective terminal event.Unlike the
UnicastProcessor, aBroadcastProcessordoesn't retain/cache items, therefore, a newSubscriberwon't receive any past items.Even though
BroadcastProcessorimplements theSubscriberinterface, callingonSubscribeis not required if the processor is used as a standalone source. However, callingonSubscribeafter theBroadcastProcessorhas failed or reached completion results in the givenSubscriptionbeing canceled immediately.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> BroadcastProcessor<T>create()Creates a newBroadcastProcessorvoidonComplete()voidonError(java.lang.Throwable failure)voidonNext(T item)voidonSubscribe(org.reactivestreams.Subscription subscription)SerializedProcessor<T,T>serialized()voidsubscribe(MultiSubscriber<? super T> downstream)-
Methods inherited from class io.smallrye.mutiny.operators.AbstractMulti
broadcast, cache, collect, convert, emitOn, group, on, onCancellation, onCompletion, onFailure, onFailure, onFailure, onItem, onOverflow, onRequest, onSubscribe, onTermination, runSubscriptionOn, select, skip, subscribe, subscribe, toHotStream, toUni, transform
-
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:
subscribein classAbstractMulti<T>
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription subscription)
- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public void onNext(T item)
- Specified by:
onNextin interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(java.lang.Throwable failure)
- Specified by:
onErrorin interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<T>
-
-