I use:
implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
implementation "org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j"
and my configs
spring:
cloud:
openfeign:
client:
circuitBreaker:
enabled: true
and
resilience4j:
circuitbreaker:
configs:
default:
registerHealthIndicator: true
slidingWindowType: TIME_BASED
slidingWindowSize: 15
minimumNumberOfCalls: 10
failureRateThreshold: 100
waitDurationInOpenState: 6000
permittedNumberOfCallsInHalfOpenState: 3
eventConsumerBufferSize: 50
My feign client looks like
@FeignClient("service_name")
@CircuitBreaker(name = "default")
public interface ServiceFeignClient {
@PostMapping(value = "/v1/something")
ResponseEntity<A> method(Request request);
and when I simulate failures the CircuitBreaker closes everything is OK. But when I remove
@CircuitBreaker(name = "default")
Nothing happens. I have 10 feignClients and do not want to name them default Is there a way to name them automatically and to apply the config at once? Can I apply CircuitBreaker annotation on all my feign clients programatically?