Class UniDelegatingSubscriber<I,O>
- java.lang.Object
-
- io.smallrye.mutiny.subscription.UniDelegatingSubscriber<I,O>
-
- All Implemented Interfaces:
ContextSupport
,UniSubscriber<I>
public class UniDelegatingSubscriber<I,O> extends java.lang.Object implements UniSubscriber<I>
-
-
Constructor Summary
Constructors Constructor Description UniDelegatingSubscriber(UniSubscriber<? super O> subscriber)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Context
context()
Provide a context.void
onFailure(java.lang.Throwable failure)
Called if the computation of the item by the subscriberUni
failed.void
onItem(I item)
Event handler called once the item has been computed by the subscribedUni
.void
onSubscribe(UniSubscription subscription)
Event handler called once the subscribedUni
has taken into account the subscription.
-
-
-
Constructor Detail
-
UniDelegatingSubscriber
public UniDelegatingSubscriber(UniSubscriber<? super O> subscriber)
-
-
Method Detail
-
context
public Context context()
Description copied from interface:ContextSupport
Provide a context.Since calls to this method shall only be triggered when a Mutiny pipeline uses a
withContext
operator, 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
withContext
operator.- Specified by:
context
in interfaceContextSupport
- Returns:
- the context, must not be
null
.
-
onSubscribe
public void onSubscribe(UniSubscription subscription)
Description copied from interface:UniSubscriber
Event handler called once the subscribedUni
has taken into account the subscription. TheUni
have triggered the computation of the item.IMPORTANT:
UniSubscriber.onItem(Object)
andUniSubscriber.onFailure(Throwable)
would not be called before the invocation of this method.- Executor: Operate on no particular executor, except if
Uni.runSubscriptionOn(Executor)
has been called - Exception: Throwing an exception cancels the subscription,
UniSubscriber.onItem(Object)
andUniSubscriber.onFailure(Throwable)
won't be called
- Specified by:
onSubscribe
in interfaceUniSubscriber<I>
- Parameters:
subscription
- the subscription allowing to cancel the computation.
- Executor: Operate on no particular executor, except if
-
onItem
public void onItem(I item)
Description copied from interface:UniSubscriber
Event handler called once the item has been computed by the subscribedUni
.IMPORTANT: this method will be only called once per subscription. If
UniSubscriber.onFailure(Throwable)
is called, this method won't be called.- Executor: Operate on no particular executor, except if
Uni.emitOn(java.util.concurrent.Executor)
has been called - Exception: Throwing an exception cancels the subscription.
- Specified by:
onItem
in interfaceUniSubscriber<I>
- Parameters:
item
- the item, may benull
.
- Executor: Operate on no particular executor, except if
-
onFailure
public void onFailure(java.lang.Throwable failure)
Description copied from interface:UniSubscriber
Called if the computation of the item by the subscriberUni
failed.IMPORTANT: this method will be only called once per subscription. If
UniSubscriber.onItem(Object)
is called, this method won't be called.- Executor: Operate on no particular executor, except if
Uni.emitOn(java.util.concurrent.Executor)
has been called - Exception: Throwing an exception cancels the subscription.
- Specified by:
onFailure
in interfaceUniSubscriber<I>
- Parameters:
failure
- the failure, cannot benull
.
- Executor: Operate on no particular executor, except if
-
-