Support The Use Of @CircuitBreaker On Methods That Return A Mono Or Flux
See original GitHub issueSay 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?
Issue Analytics
- State:
- Created 5 years ago
- Comments:24 (17 by maintainers)
Top Results From Across the Web
How to use Resilience4j Circuit Breaker with WebFlux in ...
After creating it you can call the " Mono run(Mono toRun, Function<Throwable, Mono> fallback)" (to the one that return a Flux if you...
Read more >Getting Started | Spring Cloud Circuit Breaker Guide
This guide walks you through the process of applying circuit breakers to potentially-failing method calls using Spring Cloud Circuit Breaker. What you'll build....
Read more >Making your Spring WebClient fault tolerant with Resilience4J
dependency, it'll recognize the Mono return type and will automatically compose circuit breaking into the execution flow.
Read more >Spring Cloud Circuit Breaker - Lina Romanelli
By making usage of the Circuit Breaker pattern you can let an application continue to operate when a related service fails, preventing the ......
Read more >Getting Started - resilience4j
RateLimiter, Retry, CircuitBreaker and Bulkhead annotations support synchronous return types and asynchronous types like CompletableFuture and reactive ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can we just repurpose this one?
0.14.0 is released covering that , so closing it