Class UnicastProcessor<T>
- java.lang.Object
-
- io.smallrye.mutiny.operators.AbstractMulti<T>
-
- io.smallrye.mutiny.operators.multi.processors.UnicastProcessor<T>
-
- Type Parameters:
T- the type of item
- All Implemented Interfaces:
Multi<T>,org.reactivestreams.Processor<T,T>,org.reactivestreams.Publisher<T>,org.reactivestreams.Subscriber<T>,org.reactivestreams.Subscription
public class UnicastProcessor<T> extends AbstractMulti<T> implements org.reactivestreams.Processor<T,T>, org.reactivestreams.Subscription
Implementation of a processor using a queue to store items and allows a single subscriber to receive these items.The back pressure model is not using the request protocol but the queue used to store the items. If the queue gets full, an
BackPressureFailureexception is propagated downstream.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()static <I> UnicastProcessor<I>create()Creates a newUnicastProcessorusing a new unbounded queue.static <I> UnicastProcessor<I>create(java.util.Queue<I> queue, java.lang.Runnable onTermination)Creates a newUnicastProcessorusing the given queue.booleanhasSubscriber()Checks whether there is a subscriber listening for the emitted events.voidonComplete()voidonError(java.lang.Throwable failure)voidonNext(T t)voidonSubscribe(org.reactivestreams.Subscription upstream)voidrequest(long n)SerializedProcessor<T,T>serialized()voidsubscribe(MultiSubscriber<? super T> downstream)-
Methods inherited from class io.smallrye.mutiny.operators.AbstractMulti
broadcast, cache, collect, convert, emitOn, group, log, log, 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 <I> UnicastProcessor<I> create()
Creates a newUnicastProcessorusing a new unbounded queue.- Type Parameters:
I- the type of item- Returns:
- the unicast processor
-
create
public static <I> UnicastProcessor<I> create(java.util.Queue<I> queue, java.lang.Runnable onTermination)
Creates a newUnicastProcessorusing the given queue.- Type Parameters:
I- the type of item- Parameters:
queue- the queue, must not benullonTermination- the termination callback, can benull- Returns:
- the unicast processor
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription upstream)
- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<T>
-
subscribe
public void subscribe(MultiSubscriber<? super T> downstream)
- Overrides:
subscribein classAbstractMulti<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>
-
request
public void request(long n)
- Specified by:
requestin interfaceorg.reactivestreams.Subscription
-
cancel
public void cancel()
- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
hasSubscriber
public boolean hasSubscriber()
Checks whether there is a subscriber listening for the emitted events. Mostly for testing purpose.- Returns:
trueif there is a subscriber,falseotherwise
-
serialized
public SerializedProcessor<T,T> serialized()
-
-