- java.lang.Object
-
- io.helidon.common.reactive.BaseProcessor<R,R>
-
- io.helidon.common.reactive.MultiTappedProcessor<R>
-
- Type Parameters:
R- Type of the processed items.
- All Implemented Interfaces:
Multi<R>,Subscribable<R>,Flow.Processor<R,R>,Flow.Publisher<R>,Flow.Subscriber<R>,Flow.Subscription
public class MultiTappedProcessor<R> extends BaseProcessor<R,R> implements Multi<R>
Processor executing provided functions on passing signals onNext, onError, onComplete, onCancel.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMultiTappedProcessor()Create new processor with no functions to execute when signals are intercepted.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()static <R> MultiTappedProcessor<R>create()Create new processor with no functions to execute when signals are intercepted.MultiTappedProcessor<R>onCancel(Consumer<Flow.Subscription> consumer)Set consumer to be executed when onCancel signal is intercepted.voidonComplete()MultiTappedProcessor<R>onComplete(Runnable runnable)SetRunnableto be executed when onComplete signal is intercepted.voidonError(Throwable error)MultiTappedProcessor<R>onError(Consumer<Throwable> consumer)SetConsumerto be executed when onError signal is intercepted.MultiTappedProcessor<R>onNext(Function<R,R> function)SetFunctionto be executed when onNext signal is intercepted.voidonNext(R item)MultiTappedProcessor<R>onRequest(BiFunction<Flow.Subscriber<? super R>,Long,Long> function)SetFunctionto be executed when request signal is intercepted.voidrequest(long n)request and cancel are not guaranteed to be thread-safe by the Publisher but this is not interacting with any state of this Processor - thread-safety is sub's concern - eventually the problem of the Publisher that provides the highest level Subscription.protected voidsubmit(R item)Invoke actual onNext signal to down stream.voidsubscribe(Flow.Subscriber<? super R> s)MultiTappedProcessor<R>whenSubscribe(Function<Flow.Subscriber<? super R>,Flow.Subscriber<? super R>> function)SetFunctionto be executed when subscribe signal is intercepted.-
Methods inherited from class io.helidon.common.reactive.BaseProcessor
complete, complete, downstreamSubscribe, getError, getSubscriber, getSubscription, next, onSubscribe, setError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.common.reactive.Multi
collect, collect, collectList, collectStream, defaultIfEmpty, distinct, dropWhile, filter, first, flatMap, flatMap, flatMapIterable, flatMapIterable, forEach, limit, map, onErrorResume, onErrorResumeWith, onTerminate, peek, reduce, reduce, skip, switchIfEmpty, takeUntil, takeWhile
-
Methods inherited from interface io.helidon.common.reactive.Subscribable
subscribe, subscribe, subscribe, subscribe
-
-
-
-
Method Detail
-
submit
protected void submit(R item)
Description copied from class:BaseProcessorInvoke actual onNext signal to down stream.- Specified by:
submitin classBaseProcessor<R,R>- Parameters:
item- to be sent down stream
-
create
public static <R> MultiTappedProcessor<R> create()
Create new processor with no functions to execute when signals are intercepted.- Type Parameters:
R- Type of the processed items.- Returns:
- Brand new
MultiTappedProcessor
-
onNext
public MultiTappedProcessor<R> onNext(Function<R,R> function)
SetFunctionto be executed when onNext signal is intercepted.- Parameters:
function- Function to be invoked.- Returns:
- This
MultiTappedProcessor
-
whenSubscribe
public MultiTappedProcessor<R> whenSubscribe(Function<Flow.Subscriber<? super R>,Flow.Subscriber<? super R>> function)
SetFunctionto be executed when subscribe signal is intercepted.- Parameters:
function- Function to be invoked.- Returns:
- This
MultiTappedProcessor
-
onError
public MultiTappedProcessor<R> onError(Consumer<Throwable> consumer)
SetConsumerto be executed when onError signal is intercepted.- Specified by:
onErrorin interfaceMulti<R>- Parameters:
consumer- Consumer to be executed when onError signal is intercepted, argument is interceptedThrowable.- Returns:
- This
MultiTappedProcessor
-
onComplete
public MultiTappedProcessor<R> onComplete(Runnable runnable)
SetRunnableto be executed when onComplete signal is intercepted.- Specified by:
onCompletein interfaceMulti<R>- Parameters:
runnable-Runnableto be executed.- Returns:
- This
MultiTappedProcessor
-
onRequest
public MultiTappedProcessor<R> onRequest(BiFunction<Flow.Subscriber<? super R>,Long,Long> function)
SetFunctionto be executed when request signal is intercepted.- Parameters:
function- Function to be invoked.- Returns:
- This
MultiTappedProcessor
-
onCancel
public MultiTappedProcessor<R> onCancel(Consumer<Flow.Subscription> consumer)
Set consumer to be executed when onCancel signal is intercepted.- Parameters:
consumer- Consumer to be executed when onCancel signal is intercepted, argument is interceptedFlow.Subscription.- Returns:
- This
MultiTappedProcessor
-
request
public void request(long n)
Description copied from class:BaseProcessorrequest and cancel are not guaranteed to be thread-safe by the Publisher but this is not interacting with any state of this Processor - thread-safety is sub's concern - eventually the problem of the Publisher that provides the highest level Subscription.- Specified by:
requestin interfaceFlow.Subscription- Overrides:
requestin classBaseProcessor<R,R>
-
cancel
public void cancel()
- Specified by:
cancelin interfaceFlow.Subscription- Overrides:
cancelin classBaseProcessor<R,R>
-
subscribe
public void subscribe(Flow.Subscriber<? super R> s)
- Specified by:
subscribein interfaceFlow.Publisher<R>- Overrides:
subscribein classBaseProcessor<R,R>
-
onNext
public void onNext(R item)
- Specified by:
onNextin interfaceFlow.Subscriber<R>- Overrides:
onNextin classBaseProcessor<R,R>
-
onError
public void onError(Throwable error)
- Specified by:
onErrorin interfaceFlow.Subscriber<R>- Overrides:
onErrorin classBaseProcessor<R,R>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfaceFlow.Subscriber<R>- Overrides:
onCompletein classBaseProcessor<R,R>
-
-