Interface CompletionSubscriber<T,R>

  • Type Parameters:
    T - The type of the elements that the subscriber consumes.
    R - The type of the result that the subscriber emits.
    All Superinterfaces:

    public interface CompletionSubscriber<T,R>
    extends org.reactivestreams.Subscriber<T>
    A subscriber that redeems a completion stage when it completes.

    The result is provided through a CompletionStage, which is redeemed when the subscriber receives a completion or error signal, or otherwise cancels the stream.

    The best way to instantiate one of these is using the of(org.reactivestreams.Subscriber<T>, java.util.concurrent.CompletionStage<R>) factory method.

    • Method Detail

      • getCompletion

        java.util.concurrent.CompletionStage<R> getCompletion​()
        Get the completion stage.

        This should be redeemed by the subscriber either when it cancels, or when it receives an Subscriber.onComplete() signal or an Subscriber.onError(Throwable) signal. Generally, the redeemed value or error should be the result of consuming the stream.

        The completion stage.
      • of

        static <T,R> CompletionSubscriber<T,R> of​(org.reactivestreams.Subscriber<T> subscriber,
                                                  java.util.concurrent.CompletionStage<R> completion)
        Create a CompletionSubscriber by combining the given subscriber and completion stage. The objects passed to this method should not be associated with more than one stream instance.
        subscriber - The subscriber.
        completion - The completion stage.
        A completion subscriber.