I have a http client that connects to the same api endpoint on different servers. Which server it connects to, depends on business logic.
Let's say the http client method is connect(url)
. How can I make sure that the circuit breaker takes the url into account? If my http client sends requests to both url_A
and url_B
, and server A goes down, then I want that my http client can still send requests to server B.
Does Failsafe or Resilience4J support this out-of-the-box?
Assuming that all your CircuitBreakers will use the same configuration. you can create a global config like below.
once you have the config then create a CircuitBreakerRegistry bean with a custom global configuration
Now you can get or create a CircuitBreaker with the global configuration with your URL as name using the above created CircuitBreaker Registry