I have a custom yml file configuration that holds the configs needed for the circuit breaker implemented in resilience4j.
resilience4j:
circuitbreaker:
instances:
serviceA:
eventConsumerBufferSize: 3
failureRateThreshold: 50
minimumNumberOfCalls: 2
automaticTransitionFromOpenToHalfOpenEnabled: true
waitDurationInOpenState: 5s
permittedNumberOfCallsInHalfOpenState: 3
slidingWindowSize: 10
slidingWindowType: TIME_BASED
The method that invokes the custom config file mentioned above:
@Override
@CircuitBreaker(name = "serviceA", fallbackMethod = "ContactsServiceDown")
public void runCommands(String val) {
//code logic
}
public void ContactsServiceDown() {
System.out.println("service down");
}
I have created a test method that calls runCommands
and throws an exception whenever it is invoked which executes more than 25 times, but I am not getting a hit in the fallback method. Is there any possible way we can read the values from resilance4J.yml file?