0

Spring's version of Resilience4JCircuitBreaker is a wrapper over io.github.resilience4j.circuitbreaker.CircuitBreaker and also keeps an instance of the Circuitbreaker registry. I was hoping to use an already existing CircuitBreaker instance if it was already created. Looks like there is no way to do it if using Spring Resilience4JCircuitBreaker.

E.g. If using plain Resilience4J I can do something like

CircuitBreakerRegistry registry = CircuitBreakerRegistry.ofDefaults(); // do it in the start of 
//the app.
in services. 
registry.circuitBreaker("context");

Seems like there is no way to do that with Resilience4JCircuitBreaker?

ab m
  • 422
  • 3
  • 17
  • You could have a look at our own Resilience4j Spring Boot 2 starter -> https://resilience4j.readme.io/docs/getting-started-3 You can use Annotations and configure your instances via the application config file. Demo -> https://github.com/resilience4j/resilience4j-spring-boot2-demo – Robert Winkler Feb 20 '20 at 07:05
  • Yes. Looks like that's what I'll have to do. I was hoping to use the Spring cloud implementation, but looks like I can't. – ab m Feb 20 '20 at 16:18
  • You can have a look at this blog post -> https://mromeh.com/2019/12/26/spring-cloud-gateway-with-resilience4j-circuit-breaker/ It shows how to combine Spring Cloud CircuitBreaker and our Spring Boot 2 Starter. – Robert Winkler Feb 25 '20 at 07:59

0 Answers0