We're using Spring cloud circuitbreaker to handle outages when making calls to an external service. We also have a scheduled job which calls this service. I'd like to prevent the job from running if the circuitBreaker is open but I don't see any way of checking this as neither the CircuitBreaker (Resilience4JCircuitBeaker) or the CircuitBreakerFactory expose methods that allow this to be checked. Is there another way I can achieve this?
Asked
Active
Viewed 660 times
1 Answers
2
As an alternative, you could use our Resilience4j Spring Boot 2 starter and inject the CircuitBreakerRegistry into your class in order to check the status of a CircuitBreaker instance. Our starter has a lot of other advantages like external configuration, annotation support, metrics, ...
Basically you can copy code snippets of our CircuitBreakersHealthIndicator
class.

Robert Winkler
- 1,734
- 9
- 8
-
Many thanks @robert-winkler, that worked perfectly. I'll leave the question unanswered for now just in case anyone knows how to do it with Spring cloud circuitbreaker. – Jim.R Nov 11 '20 at 14:08