When I test in my local it works fine, where in case of exception after 6 events, circuit is opened. And after 300seconds (5 minutes) circuitbreaker goes in half open state.
I have following logs configured:
@Slf4j
@Configuration
public class CircuitBreakerConfig {
private final BindingsLifecycleController bindingsLifecycleController;
public CircuitBreakerConfig(CircuitBreakerRegistry circuitBreakerRegistry, BindingsLifecycleController bindingsLifecycleController) {
this.bindingsLifecycleController = bindingsLifecycleController;
CircuitBreaker circuitBreaker = circuitBreakerRegistry.circuitBreaker("myEventCircuitBreaker");
circuitBreaker.getEventPublisher()
.onStateTransition(this::handleStateTransition);
}
private void handleStateTransition(CircuitBreakerOnStateTransitionEvent event) {
String bindingName = "stockEventConsumer-in-0";
switch (event.getStateTransition().getToState()) {
case OPEN:
log.info("circuitbreaker state:: open");
bindingsLifecycleController.changeState(bindingName, State.PAUSED);
break;
case HALF_OPEN:
log.info("circuitbreaker state:: half_open");
bindingsLifecycleController.changeState(bindingName, State.RESUMED);
break;
case CLOSED:
log.info("circuitbreaker state:: closed");
bindingsLifecycleController.changeState(bindingName, State.RESUMED);
break;
default:
log.error("circuitbreaker unknown state");
}
}
}
The issue what I am facing is when I deploy my code in my dev/ppe environment, after 6 events with exception I am getting circuit open log.
But after that its not moving to half open state, and I don't see any logs from the configuration.
The circuitbreaker remains open infinitely without going to half open state.
Resilience4j version: resilience4j-circuitbreaker-2.1.0.jar
Java version: JDK17
I have circuitbreaker implemented in my springboot application. I have used following dependency:
implementation 'org.springframework.cloud:spring-cloud-starter-circuitbreaker-resilience4j' And I have following properties configured for my testing:
When I test in my local it works fine, where in case of exception after 6 events, circuit is opened. And after 300seconds (5 minutes) circuitbreaker goes in half open state.
I have following logs configured:
The issue what I am facing is when I deploy my code in my dev/ppe environment, after 6 events with exception I am getting circuit open log.
But after that its not moving to half open state, and I don't see any logs from the configuration. The circuitbreaker remains open infinitely without going to half open state.