Package com.couchbase.client.core
Class Reactor
- java.lang.Object
-
- com.couchbase.client.core.Reactor
-
public class Reactor extends Object
This class provides utility methods when working with reactor.- Since:
- 2.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,C extends Iterable<T>>
Flux<T>toFlux(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 Detail
-
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
public static <T> Mono<T> toMono(Supplier<CompletableFuture<T>> input)
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
public static <T,C extends Iterable<T>> Flux<T> toFlux(Supplier<CompletableFuture<C>> input)
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.
-
-