resilience4j
resilience4j copied to clipboard
On state transition not working on 1.7.1
Resilience4j version: 1.7.1
Java version: 11
Hi team of resilience. I had a problem with the version 1.7.1 that I don't have any way to invoke my lambda expression declared on my circuit breaker .onStateTransition. The lambda expression declared on .onEvent works.
CircuitBreakerRegistry circuitBreakerRegistry = CircuitBreakerRegistry.of(circuitBreakerConfig); CircuitBreaker circuitBreaker = circuitBreakerRegistry.circuitBreaker("myCircuitBreaker"); circuitBreaker.getEventPublisher() .onStateTransition(this::handleTransitionEvent);
I tried many different things such review the CircuitBreaker instance (I use Beans to declare the CircuitBreakerConfig and CircuitBreaker, and another beans to put in the context of my rest template instance, I used an ClientHttpRequestInterceptor for it. Used DependsOn, Lazy, and check if the problem is that my spring boot application use proxies (i understand this is true, idk).
And the only solution that immediately fix my problem was downgrade the version to 1.7.0.
I removed all annotations like DependsOn, Lazy to instantiate the beans and its still work.
I can do if u guys wanna it, debug my application to understand this. But idk how i can do by myself and extract relevant things.
So, I hope this experience helps to another ones that has this problem and saving four-days investigation in the web and best friend ChatGPT.
Hopes, Manflack
10/05/24 - The dependency used was resilience4j-circuitbreaker.
Hi,
can you show me some more code?
What happens if you just invoke circuitBreaker.transitionToOpenState()?