- Type Parameters:
T- the expected type of item
- All Superinterfaces:
ContextSupport
- All Known Implementing Classes:
UniAssertSubscriber,UniDelegatingSubscriber,UniSerializedSubscriber
Will receive call to
onSubscribe(UniSubscription) once after passing an instance of this UniSubscriber
to UniSubscribe.withSubscriber(UniSubscriber) retrieved from Uni.subscribe().
Unlike Reactive Streams Subscriber, UniSubscriber does not request items.
After subscription, it can receive:
- a item event triggering
onItem(Object). The item can benull. - a failure event triggering
onFailure(Throwable)which signals an error state.
Once this subscriber receives an item or failure event, no more events will be received.
Note that unlike in Reactive Streams, the value received in onItem(Object) can be null.
-
Method Summary
Modifier and TypeMethodDescriptionvoidCalled if the computation of the item by the subscriberUnifailed.voidEvent handler called once the item has been computed by the subscribedUni.voidonSubscribe(UniSubscription subscription) Event handler called once the subscribedUnihas taken into account the subscription.Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport
context
-
Method Details
-
onSubscribe
Event handler called once the subscribedUnihas taken into account the subscription. TheUnihave triggered the computation of the item.IMPORTANT:
onItem(Object)andonFailure(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,
onItem(Object)andonFailure(Throwable)won't be called
- Parameters:
subscription- the subscription allowing to cancel the computation.
- Executor: Operate on no particular executor, except if
-
onItem
Event handler called once the item has been computed by the subscribedUni.IMPORTANT: this method will be only called once per subscription. If
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.
- Parameters:
item- the item, may benull.
- Executor: Operate on no particular executor, except if
-
onFailure
Called if the computation of the item by the subscriberUnifailed.IMPORTANT: this method will be only called once per subscription. If
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.
- Parameters:
failure- the failure, cannot benull.
- Executor: Operate on no particular executor, except if
-