resilience4j: Support The Use Of @CircuitBreaker On Methods That Return A Mono Or Flux
Say I have this simple class in a Spring Boot 2 app
@CircuitBreaker(name = "httpbin")
public class WebClientHttpbinService {
private WebClient client;
public WebClientHttpbinService() {
this.client = WebClient.create("http://httpbin.org");
}
public Mono<Map> delay(int seconds) {
return client.get().uri("/delay/{seconds}", seconds).exchange().flatMap(r -> r.bodyToMono(Map.class)).timeout(Duration.ofSeconds(3));
}
}
I am finding that even if the delay method times out (theWebClient request takes longer than 3 seconds) that the httpbin circuit breaker does not could that as a failure. This makes sense as the method actually completed successfully in returning the Mono<Map>. So should the @CircuitBreaker annotation not be used with methods that return reactive types?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 24 (17 by maintainers)
Commits related to this issue
- #258 Add the support of spring reactor types in the circuit breaker annotation AOP handling — committed to Romeh/resilience4j by Romeh 6 years ago
- #258 add the support to the webflux types in the circuit breaker annotation AOP — committed to Romeh/resilience4j by Romeh 6 years ago
- #258 review comments — committed to Romeh/resilience4j by Romeh 5 years ago
- #258 review comments — committed to Romeh/resilience4j by Romeh 5 years ago
- Issue #258: Add webflux support circuitbreaker annotation * Add response predicate to retry sync and async for enhancement #259 * #258 add the support to the webflux types in the circuit breaker ... — committed to resilience4j/resilience4j by Romeh 5 years ago
Can we just repurpose this one?