Module io.smallrye.mutiny
Package io.smallrye.mutiny.subscription
Class Subscribers.CallbackBasedSubscriber<T>
java.lang.Object
io.smallrye.mutiny.subscription.Subscribers.CallbackBasedSubscriber<T>
- All Implemented Interfaces:
Cancellable,CancellableSubscriber<T>,ContextSupport,MultiSubscriber<T>,Flow.Subscriber<T>,Flow.Subscription
- Enclosing class:
Subscribers
public static class Subscribers.CallbackBasedSubscriber<T>
extends Object
implements CancellableSubscriber<T>, Flow.Subscription, ContextSupport
-
Constructor Summary
ConstructorsConstructorDescriptionCallbackBasedSubscriber(Context context, Consumer<? super T> onItem, Consumer<? super Throwable> onFailure, Runnable onCompletion, Consumer<? super Flow.Subscription> onSubscription) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Runs the cancellation action.context()Provide a context.voidMethod called when the upstream emits acompletionterminal event.voidMethod called when the upstream emits afailureterminal event.voidMethod called when the upstream emits anitemevent, in response to to requests toFlow.Subscription.request(long).voidvoidrequest(long n) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.smallrye.mutiny.subscription.MultiSubscriber
onComplete, onError, onNext
-
Constructor Details
-
CallbackBasedSubscriber
-
-
Method Details
-
context
Description copied from interface:ContextSupportProvide a context.Since calls to this method shall only be triggered when a Mutiny pipeline uses a
withContextoperator, there is no need in general for caching the context value in a field of the implementing class. Exceptions include operators that have cross-subscriber semantics such as memoizers or broadcasters.This method is expected to be called once per
withContextoperator.- Specified by:
contextin interfaceContextSupport- Returns:
- the context, must not be
null.
-
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<T>
-
onItem
Description copied from interface:MultiSubscriberMethod called when the upstream emits anitemevent, in response to to requests toFlow.Subscription.request(long).- Specified by:
onItemin interfaceMultiSubscriber<T>- Parameters:
item- the item, must not benull.
-
onFailure
Description copied from interface:MultiSubscriberMethod called when the upstream emits afailureterminal event.No further events will be sent even if
Flow.Subscription.request(long)is invoked again.- Specified by:
onFailurein interfaceMultiSubscriber<T>- Parameters:
t- the failure, must not benull.
-
onCompletion
public void onCompletion()Description copied from interface:MultiSubscriberMethod called when the upstream emits acompletionterminal event.No further events will be sent even if
Flow.Subscription.request(long)is invoked again.- Specified by:
onCompletionin interfaceMultiSubscriber<T>
-
request
public void request(long n) - Specified by:
requestin interfaceFlow.Subscription
-
cancel
public void cancel()Description copied from interface:CancellableRuns the cancellation action.- Specified by:
cancelin interfaceCancellable- Specified by:
cancelin interfaceFlow.Subscription
-