I am implementing a new method that we want protected with a circuit breaker and I'm following the same pattern as works on another method and yet it isn't working.
@Timed("data")
@CircuitBreaker(name = "data")
@Retry(name = "data")
@TimeLimiter(name = "data")
public void data() {
try {
doSomething();
catch (Exception e) {
log.error(e.getClass().toString());
throw e;
}
}
I am then calling that method in a loop without a mock back end started so that every call fails and the circuit breaker should open, but it is not.
The output shows the exception is org.springframework.web.reactive.function.client.WebClientRequestException
I have it configured as:
resilience4j:
circuitbreaker:
instances:
data:
wait-duration-in-open-state: 1000
minimum-number-of-calls: 6
permitted-number-of-calls-in-half-open-state: 3
retry:
retryAspectOrder: 2
instances:
data:
max-attempts: 2
retryExceptions:
- org.springframework.web.reactive.function.client.WebClientResponseException
- org.springframework.web.reactive.function.client.WebClientRequestException
timelimiter:
instances:
data:
timeoutDuration: 100ms
What would cause it not to open?
resilience4j 2.0.2 spring cloud 3.0.0 JDK 17 OS X 14.1.1
It turns out, there was a mock bean being created and it was blocking the annotations from even being applied.