T
- The type of the elements that the subscriber consumes.R
- The type of the result that the subscriber emits.public interface CompletionSubscriber<T,R>
extends org.reactivestreams.Subscriber<T>
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.
Modifier and Type | Method and Description |
---|---|
CompletionStage<R> |
getCompletion()
Get the completion stage.
|
static <T,R> CompletionSubscriber<T,R> |
of(org.reactivestreams.Subscriber<T> subscriber,
CompletionStage<R> completion)
Create a
CompletionSubscriber by combining the given subscriber and completion stage. |
CompletionStage<R> getCompletion()
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.
static <T,R> CompletionSubscriber<T,R> of(org.reactivestreams.Subscriber<T> subscriber, CompletionStage<R> completion)
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.
The returned CompletionSubscriber
will delegate calls from the Subscriber
interface to
subscriber
and will return completion
from getCompletion()
.
It is the callers responsibility to ensure that completion
is completed with the correct value when
subscriber
terminates.
subscriber
- The subscriber.completion
- The completion stage.Copyright © 2018 – 2022 Eclipse Foundation. All rights reserved.
Use is subject to license terms.