Reputation: 743
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?
Upvotes: 0
Views: 1357
Reputation: 1927
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.
Upvotes: 2