I am looking at the Spring Cloud Circuit Breaker example with respect to using a Reactive API. I understand the basics and how the fallback mechanism works for WebClient
but can't see how to implement a fail-fast solution for when the circuit breaker is open.
This would be the example method I would like to make 'fail-fast' (taken from the article).
public Mono<String> slow() {
return webClient.get().uri("/slow").retrieve()
.bodyToMono(String.class).transform(it -> {
CircuitBreaker cb = cbFactory.create("slow");
return cb.run(it, throwable ->
Mono.just("fallback"));
});
}
Any help or insight into this much appreciated.