question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support The Use Of @CircuitBreaker On Methods That Return A Mono Or Flux

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:24 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
ryanjbaxtercommented, Sep 4, 2018

Can we just repurpose this one?

0reactions
Romehcommented, Apr 5, 2019

0.14.0 is released covering that , so closing it

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found