Interface UniSubscriber<T>

Type Parameters:
T - the expected type of item
All Superinterfaces:
ContextSupport
All Known Implementing Classes:
UniAssertSubscriber, UniDelegatingSubscriber, UniSerializedSubscriber

public interface UniSubscriber<T> extends ContextSupport
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:

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 Type
    Method
    Description
    void
    Called if the computation of the item by the subscriber Uni failed.
    void
    onItem(T item)
    Event handler called once the item has been computed by the subscribed Uni.
    void
    Event handler called once the subscribed Uni has taken into account the subscription.

    Methods inherited from interface io.smallrye.mutiny.subscription.ContextSupport

    context
  • Method Details

    • onSubscribe

      void onSubscribe(UniSubscription subscription)
      Event handler called once the subscribed Uni has taken into account the subscription. The Uni have triggered the computation of the item.

      IMPORTANT: onItem(Object) and onFailure(Throwable) would not be called before the invocation of this method.

      Parameters:
      subscription - the subscription allowing to cancel the computation.
    • onItem

      void onItem(T item)
      Event handler called once the item has been computed by the subscribed Uni.

      IMPORTANT: this method will be only called once per subscription. If onFailure(Throwable) is called, this method won't be called.

      Parameters:
      item - the item, may be null.
    • onFailure

      void onFailure(Throwable failure)
      Called if the computation of the item by the subscriber Uni failed.

      IMPORTANT: this method will be only called once per subscription. If onItem(Object) is called, this method won't be called.

      Parameters:
      failure - the failure, cannot be null.