Package com.couchbase.client.core.util
Class LatestStateSubscription<T>
java.lang.Object
com.couchbase.client.core.util.LatestStateSubscription<T>
Useful when only the latest value of a Flux is interesting,
and processing values is relatively expensive.
Think of it as applying a hypothetical "sampleLatest" operator to the upstream flux before subscribing. In other words, it ignores all but the latest value.
Only one value is processed at a time. The processing happens asynchronously with respect to the Flux.
Requires collaboration with the subscriber; after processing each value, the subscriber must run a callback to signal readiness for the next value.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLatestStateSubscription
(reactor.core.publisher.Flux<T> flux, reactor.core.scheduler.Scheduler scheduler, LatestStateSubscription.AsyncSubscriber<T> subscriber) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono
<Void> Returns a Mono that completes after the upstream flux terminates and its final value is completely processed.
-
Constructor Details
-
LatestStateSubscription
public LatestStateSubscription(reactor.core.publisher.Flux<T> flux, reactor.core.scheduler.Scheduler scheduler, LatestStateSubscription.AsyncSubscriber<T> subscriber)
-
-
Method Details
-
awaitTermination
Returns a Mono that completes after the upstream flux terminates and its final value is completely processed.
-