Package com.couchbase.client.core
Class Reactor
java.lang.Object
com.couchbase.client.core.Reactor
This class provides utility methods when working with reactor.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptiontoFlux
(Supplier<CompletableFuture<C>> input) Helper method to wrap an async call into a reactive one and translate exceptions appropriately.static <T> Mono<T>
toMono
(Supplier<CompletableFuture<T>> input) Helper method to wrap an async call into a reactive one and translate exceptions appropriately.static <T> Mono<T>
wrap
(Request<?> request, CompletableFuture<T> response, boolean propagateCancellation)
-
Method Details
-
wrap
public static <T> Mono<T> wrap(Request<?> request, CompletableFuture<T> response, boolean propagateCancellation) - Parameters:
request
- the request to wrap.response
- the full response to wrap, might not be the same as in the request.propagateCancellation
- if a cancelled/unsubscribed mono should also cancel the request.- Returns:
- the mono that wraps the request.
-
toMono
Helper method to wrap an async call into a reactive one and translate exceptions appropriately.- Parameters:
input
- a supplier that will be called on every subscription.- Returns:
- a mono that invokes the given supplier on each subscription.
-
toFlux
Helper method to wrap an async call into a reactive one and translate exceptions appropriately.- Parameters:
input
- a supplier that will be called on every subscription.- Returns:
- a flux that invokes the given supplier on each subscription.
-