Interface MultiSubscriber<T>

  • Type Parameters:
    T - the type of item.
    All Superinterfaces:
    java.util.concurrent.Flow.Subscriber<T>
    All Known Subinterfaces:
    CancellableSubscriber<T>
    All Known Implementing Classes:
    AssertSubscriber, MultiSubscriberAdapter, SerializedSubscriber, Subscribers.CallbackBasedSubscriber, SwitchableSubscriptionSubscriber

    public interface MultiSubscriber<T>
    extends java.util.concurrent.Flow.Subscriber<T>
    A Flow.Subscriber receiving calls to Flow.Subscriber.onSubscribe(Subscription) once after passing an instance of Flow.Subscriber to Flow.Publisher.subscribe(Subscriber).

    No further events will be received until Flow.Subscription.request(long) is called.

    After signaling demand:

    • One or more invocations of onItem(Object) up to the maximum number defined by Flow.Subscription.request(long)
    • Single invocation of onFailure(Throwable) or onCompletion() which signals a terminal state after which no further events will be sent.

    Demand can be signaled via Flow.Subscription.request(long) whenever the Flow.Subscriber instance is capable of handling more.

    This interface bridges the Mutiny model and the Reactive Streams model.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void onComplete()
      Successful terminal state.
      void onCompletion()
      Method called when the upstream emits a completion terminal event.
      default void onError​(java.lang.Throwable t)
      Failed terminal state.
      void onFailure​(java.lang.Throwable failure)
      Method called when the upstream emits a failure terminal event.
      void onItem​(T item)
      Method called when the upstream emits an item event, in response to to requests to Flow.Subscription.request(long).
      default void onNext​(T t)
      Data notification sent by the Flow.Publisher in response to requests to Flow.Subscription.request(long).
      • Methods inherited from interface java.util.concurrent.Flow.Subscriber

        onSubscribe
    • Method Detail

      • onItem

        void onItem​(T item)
        Method called when the upstream emits an item event, in response to to requests to Flow.Subscription.request(long).
        Parameters:
        item - the item, must not be null.
      • onFailure

        void onFailure​(java.lang.Throwable failure)
        Method called when the upstream emits a failure terminal event.

        No further events will be sent even if Flow.Subscription.request(long) is invoked again.

        Parameters:
        failure - the failure, must not be null.
      • onCompletion

        void onCompletion()
        Method called when the upstream emits a completion terminal event.

        No further events will be sent even if Flow.Subscription.request(long) is invoked again.

      • onNext

        default void onNext​(T t)
        Data notification sent by the Flow.Publisher in response to requests to Flow.Subscription.request(long). Delegates to onItem(Object)
        Specified by:
        onNext in interface java.util.concurrent.Flow.Subscriber<T>
        Parameters:
        t - the element signaled
      • onError

        default void onError​(java.lang.Throwable t)
        Failed terminal state.

        No further events will be sent even if Flow.Subscription.request(long) is invoked again. Delegates to onFailure(Throwable)

        Specified by:
        onError in interface java.util.concurrent.Flow.Subscriber<T>
        Parameters:
        t - the throwable signaled
      • onComplete

        default void onComplete()
        Successful terminal state.

        No further events will be sent even if Flow.Subscription.request(long) is invoked again. Delegates to onCompletion()

        Specified by:
        onComplete in interface java.util.concurrent.Flow.Subscriber<T>