Class UniOnEvent<T>

  • Type Parameters:
    T - the type of item emitted by the Uni

    @Deprecated
    public class UniOnEvent<T>
    extends java.lang.Object
    Deprecated.
    Use the specialized groups in Uni instead, e.g. Uni.onItem() or Uni.onTermination().
    Allows configuring the action to execute on each type of events emitted by a Uni or by a UniSubscriber
    • Constructor Detail

      • UniOnEvent

        public UniOnEvent​(Uni<T> upstream)
        Deprecated.
    • Method Detail

      • subscribed

        @Deprecated
        public Uni<T> subscribed​(java.util.function.Consumer<? super UniSubscription> consumer)
        Deprecated.
        Uni Uni.onSubscribe() instead.
        Attaches an action executed when the 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.

        Parameters:
        consumer - the callback, must not be null
        Returns:
        a new Uni
      • cancellation

        @Deprecated
        public Uni<T> cancellation​(java.lang.Runnable runnable)
        Deprecated.
        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 be null
        Returns:
        a new Uni
      • termination

        @Deprecated
        public Uni<T> termination​(Functions.TriConsumer<T,​java.lang.Throwable,​java.lang.Boolean> consumer)
        Deprecated.
        Use uni.onTermination().invoke(...) instead
        Attaches an action that is executed when the Uni emits 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 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.
        Returns:
        the new Uni
      • termination

        @Deprecated
        public Uni<T> termination​(java.lang.Runnable action)
        Deprecated.
        Use uni.onTermination().invoke(...) instead
        Attaches an action that is executed when the Uni 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.
        Parameters:
        action - the action to run, must not be null
        Returns:
        the new Uni
      • item

        @Deprecated
        public UniOnItem<T> item()
        Deprecated.
        Use Uni.onItem() instead
        Configures the action to execute when the observed 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)
         
         
        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.
        Use Uni.onFailure() instead
        Like failure(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.
        Configures a predicate filtering the failures on which the behavior (specified with the returned 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.*

        Parameters:
        predicate - the predicate, null means 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.
        Use Uni.onFailure(Class) )} instead
        Configures a type of failure filtering the failures on which the behavior (specified with the returned 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.*

        Parameters:
        typeOfFailure - the class of exception, must not be null
        Returns:
        a UniOnFailure configured with the given predicate on which you can specify the on failure action
      • cancellation

        @Deprecated
        public UniOnCancel<T> cancellation()
        Deprecated.
        Use Uni.onCancellation() )} instead
        Configures actions when the subscription is cancelled.
        Returns:
        the object to configure the actions
      • subscribe

        @Deprecated
        public UniOnSubscribe<T> subscribe()
        Deprecated.
        Use Uni.onSubscribe() )} instead
        Configure actions when receiving a subscription.
        Returns:
        the object to configure the actions
      • termination

        @Deprecated
        public UniOnTerminate<T> termination()
        Deprecated.
        Use Uni.onTermination() )} instead
        Configures actions when the Uni terminates on either an item, a failure or a cancellation.
        Returns:
        the object to configure the actions
      • itemOrFailure

        @Deprecated
        public UniOnItemOrFailure<T> itemOrFailure()
        Deprecated.
        Use Uni.onItemOrFailure() )} instead
        Configures actions when receiving either an item or a failure.
        Returns:
        the object to configure the actions