Class UniCallbackSubscriber<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      UniCallbackSubscriber​(java.util.function.Consumer<? super T> onResultCallback, java.util.function.Consumer<? super java.lang.Throwable> onFailureCallback)
      Creates a UniSubscriber consuming the item and failure of a Uni.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()
      Requests the Uni to cancel and clean up resources.
      void onFailure​(java.lang.Throwable t)
      Called if the computation of the item by the subscriber Uni failed.
      void onItem​(T x)
      Event handler called once the item has been computed by the subscribed Uni.
      void onSubscribe​(UniSubscription sub)
      Event handler called once the subscribed Uni has taken into account the subscription.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UniCallbackSubscriber

        public UniCallbackSubscriber​(java.util.function.Consumer<? super T> onResultCallback,
                                     java.util.function.Consumer<? super java.lang.Throwable> onFailureCallback)
        Creates a UniSubscriber consuming the item and failure of a Uni.
        Parameters:
        onResultCallback - callback invoked on item event, must not be null
        onFailureCallback - callback invoked on failure event, must not be null
    • Method Detail

      • onFailure

        public final void onFailure​(java.lang.Throwable t)
        Description copied from interface: UniSubscriber
        Called if the computation of the item by the subscriber Uni failed. IMPORTANT: this method will be only called once per subscription. If UniSubscriber.onItem(Object) is called, this method won't be called.
        Specified by:
        onFailure in interface UniSubscriber<T>
        Parameters:
        t - the failure, cannot be null.
      • onItem

        public final void onItem​(T x)
        Description copied from interface: UniSubscriber
        Event handler called once the item has been computed by the subscribed Uni. IMPORTANT: this method will be only called once per subscription. If UniSubscriber.onFailure(Throwable) is called, this method won't be called.
        Specified by:
        onItem in interface UniSubscriber<T>
        Parameters:
        x - the item, may be null.
      • cancel

        public void cancel()
        Description copied from interface: UniSubscription
        Requests the Uni to cancel and clean up resources. If the item is retrieved after cancellation, it is not forwarded to the subscriber. If the cancellation happens after the delivery of the item, this call is ignored.

        Calling this method, emits the cancellation event upstream.

        Specified by:
        cancel in interface Cancellable
        Specified by:
        cancel in interface org.reactivestreams.Subscription
        Specified by:
        cancel in interface UniSubscription