T - the type of item emitted by the Unipublic class UniOnEvent<T> extends Object
Uni or by
a UniSubscriber| Constructor and Description |
|---|
UniOnEvent(Uni<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
Uni<T> |
cancellation(Runnable runnable)
Attaches an action executed when a subscription is cancelled.
|
UniOnFailure<T> |
failure()
Like
failure(Predicate) but applied to all failures fired by the upstream uni. |
UniOnFailure<T> |
failure(Class<? extends Throwable> typeOfFailure)
Configures a type of failure filtering the failures on which the behavior (specified with the returned
UniOnFailure) is applied. |
UniOnFailure<T> |
failure(Predicate<? super Throwable> predicate)
Configures a predicate filtering the failures on which the behavior (specified with the returned
UniOnFailure) is applied. |
UniOnItem<T> |
item()
Configures the action to execute when the observed
Uni emits the item (potentially null). |
Uni<T> |
subscribed(Consumer<? super UniSubscription> consumer)
Deprecated.
Uni
Uni.onSubscribe() instead. |
Uni<T> |
termination(Functions.TriConsumer<T,Throwable,Boolean> consumer)
Deprecated.
Use
uni.onTermination().invoke(...) instead |
Uni<T> |
termination(Runnable action)
Deprecated.
Use
uni.onTermination().invoke(...) instead |
@Deprecated public Uni<T> subscribed(Consumer<? super UniSubscription> consumer)
Uni.onSubscribe() instead.Uni has received a UniSubscription from upstream.
The downstream does not have received the subscription yet. It will be done once the action completes.
This method is not intended to cancel the subscription. It's the responsibility of the subscriber to do so.
consumer - the callback, must not be nullUnipublic Uni<T> cancellation(Runnable runnable)
runnable - the callback, must not be nullUni@Deprecated public Uni<T> termination(Functions.TriConsumer<T,Throwable,Boolean> consumer)
uni.onTermination().invoke(...) insteadUni emits an item or a failure or when the subscriber
cancels the subscription.consumer - the consumer receiving the item, the failure and a boolean indicating whether the termination
is due to a cancellation (the 2 first parameters would be null in this case). Must not
be null If the second parameter (the failure) is not null, the first is
necessary null and the third is necessary false as it indicates a termination
due to a failure.Uni@Deprecated public Uni<T> termination(Runnable action)
uni.onTermination().invoke(...) insteadUni emits an item or a failure or when the subscriber
cancels the subscription. Unlike termination(Functions.TriConsumer), the callback does not receive
the item, failure or cancellation.action - the action to run, must not be nullUnipublic UniOnItem<T> item()
Uni emits the item (potentially null).
Examples:
Uni<T> uni = ...;
uni.onItem().transform(x -> ...); // Transform the item into another item (~ map)
uni.onItem().transformToUni(x -> ...); // Transform the item into a Uni (~ flatMap)
Uni.ifNoItem()public UniOnFailure<T> failure()
failure(Predicate) but applied to all failures fired by the upstream uni.
It allows configuring the on failure behavior (recovery, retry...).public UniOnFailure<T> failure(Predicate<? super Throwable> predicate)
UniOnFailure) is applied.
For instance, to only when an IOException is fired as failure you can use:
uni.onFailure(IOException.class).recoverWithItem("hello")
The fallback value (hello) will only be used if the upstream uni fire a failure of type
IOException.*
predicate - the predicate, null means applied to all failurespublic UniOnFailure<T> failure(Class<? extends Throwable> typeOfFailure)
UniOnFailure) is applied.
For instance, to only when an IOException is fired as failure you can use:
uni.onFailure(IOException.class).recoverWithItem("hello")
The fallback value (hello) will only be used if the upstream uni fire a failure of type
IOException.*
typeOfFailure - the class of exception, must not be nullCopyright © 2019–2020 SmallRye. All rights reserved.