Package io.smallrye.mutiny.groups
Class UniOnEvent<T>
- java.lang.Object
-
- io.smallrye.mutiny.groups.UniOnEvent<T>
-
- Type Parameters:
T- the type of item emitted by theUni
@Deprecated public class UniOnEvent<T> extends java.lang.ObjectDeprecated.Allows configuring the action to execute on each type of events emitted by aUnior by aUniSubscriber
-
-
Constructor Summary
Constructors Constructor Description UniOnEvent(Uni<T> upstream)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description UniOnCancel<T>cancellation()Deprecated.UseUni.onCancellation())} insteadUni<T>cancellation(java.lang.Runnable runnable)Deprecated.UseUni.onCancellation()instead.UniOnFailure<T>failure()Deprecated.UseUni.onFailure()insteadUniOnFailure<T>failure(java.lang.Class<? extends java.lang.Throwable> typeOfFailure)Deprecated.UseUni.onFailure(Class))} insteadUniOnFailure<T>failure(java.util.function.Predicate<? super java.lang.Throwable> predicate)Deprecated.UseUni.onFailure(Predicate))} insteadUniOnItem<T>item()Deprecated.UseUni.onItem()insteadUniOnItemOrFailure<T>itemOrFailure()Deprecated.UseUni.onItemOrFailure())} insteadUniOnSubscribe<T>subscribe()Deprecated.UseUni.onSubscribe())} insteadUni<T>subscribed(java.util.function.Consumer<? super UniSubscription> consumer)Deprecated.UniUni.onSubscribe()instead.UniOnTerminate<T>termination()Deprecated.UseUni.onTermination())} insteadUni<T>termination(Functions.TriConsumer<T,java.lang.Throwable,java.lang.Boolean> consumer)Deprecated.Useuni.onTermination().invoke(...)insteadUni<T>termination(java.lang.Runnable action)Deprecated.Useuni.onTermination().invoke(...)instead
-
-
-
Method Detail
-
subscribed
@Deprecated public Uni<T> subscribed(java.util.function.Consumer<? super UniSubscription> consumer)
Deprecated.UniUni.onSubscribe()instead.Attaches an action executed when theUnihas received aUniSubscriptionfrom 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.
- Parameters:
consumer- the callback, must not benull- Returns:
- a new
Uni
-
cancellation
@Deprecated public Uni<T> cancellation(java.lang.Runnable runnable)
Deprecated.UseUni.onCancellation()instead.Attaches an action executed when a subscription is cancelled. The upstream is not cancelled yet, but will when the callback completes.- Parameters:
runnable- the callback, must not benull- Returns:
- a new
Uni
-
termination
@Deprecated public Uni<T> termination(Functions.TriConsumer<T,java.lang.Throwable,java.lang.Boolean> consumer)
Deprecated.Useuni.onTermination().invoke(...)insteadAttaches an action that is executed when theUniemits an item or a failure or when the subscriber cancels the subscription.- Parameters:
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 benullin this case). Must not benullIf the second parameter (the failure) is notnull, the first is necessarynulland the third is necessaryfalseas it indicates a termination due to a failure.- Returns:
- the new
Uni
-
termination
@Deprecated public Uni<T> termination(java.lang.Runnable action)
Deprecated.Useuni.onTermination().invoke(...)insteadAttaches an action that is executed when theUniemits an item or a failure or when the subscriber cancels the subscription. Unliketermination(Functions.TriConsumer), the callback does not receive the item, failure or cancellation.- Parameters:
action- the action to run, must not benull- Returns:
- the new
Uni
-
item
@Deprecated public UniOnItem<T> item()
Deprecated.UseUni.onItem()insteadConfigures the action to execute when the observedUniemits the item (potentiallynull).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)- Returns:
- the object to configure the action to execute when an item is emitted
- See Also:
Uni.ifNoItem()
-
failure
@Deprecated public UniOnFailure<T> failure()
Deprecated.UseUni.onFailure()insteadLikefailure(Predicate)but applied to all failures fired by the upstream uni. It allows configuring the on failure behavior (recovery, retry...).- Returns:
- a UniOnFailure on which you can specify the on failure action
-
failure
@Deprecated public UniOnFailure<T> failure(java.util.function.Predicate<? super java.lang.Throwable> predicate)
Deprecated.UseUni.onFailure(Predicate))} insteadConfigures a predicate filtering the failures on which the behavior (specified with the returnedUniOnFailure) is applied.For instance, to only when an
IOExceptionis 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 typeIOException.*- Parameters:
predicate- the predicate,nullmeans applied to all failures- Returns:
- a UniOnFailure configured with the given predicate on which you can specify the on failure action
-
failure
@Deprecated public UniOnFailure<T> failure(java.lang.Class<? extends java.lang.Throwable> typeOfFailure)
Deprecated.UseUni.onFailure(Class))} insteadConfigures a type of failure filtering the failures on which the behavior (specified with the returnedUniOnFailure) is applied.For instance, to only when an
IOExceptionis 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 typeIOException.*- Parameters:
typeOfFailure- the class of exception, must not benull- Returns:
- a UniOnFailure configured with the given predicate on which you can specify the on failure action
-
cancellation
@Deprecated public UniOnCancel<T> cancellation()
Deprecated.UseUni.onCancellation())} insteadConfigures actions when the subscription is cancelled.- Returns:
- the object to configure the actions
-
subscribe
@Deprecated public UniOnSubscribe<T> subscribe()
Deprecated.UseUni.onSubscribe())} insteadConfigure actions when receiving a subscription.- Returns:
- the object to configure the actions
-
termination
@Deprecated public UniOnTerminate<T> termination()
Deprecated.UseUni.onTermination())} insteadConfigures actions when theUniterminates on either an item, a failure or a cancellation.- Returns:
- the object to configure the actions
-
itemOrFailure
@Deprecated public UniOnItemOrFailure<T> itemOrFailure()
Deprecated.UseUni.onItemOrFailure())} insteadConfigures actions when receiving either an item or a failure.- Returns:
- the object to configure the actions
-
-