Closed a0d00kc closed 4 years ago
@ryanjbaxter can you please help me with this?
@a0d00kc Can you try Customizer.once
?
https://cloud.spring.io/spring-cloud-static/spring-cloud-commons/2.2.2.RELEASE/reference/html/#configuration
@making can you elaborate how to use it. Please reference the code above
@a0d00kc he linked to the docs where there is an example.
Customizer.once(circuitBreaker -> {
circuitBreaker.getEventPublisher()
.onStateTransition(event -> log.info("{}: {}", event.getCircuitBreakerName(), event.getStateTransition()));
}, CircuitBreaker::getName)
@spencergibb sorry I was new to reactive so wasn't able to figure out immediately how to use
Customizer.once(circuitBreaker -> {
circuitBreaker.getEventPublisher()
.onStateTransition(event -> log.info("{}: {}", event.getCircuitBreakerName(), event.getStateTransition()));
}, CircuitBreaker::getName)
But yeah I got it now and it's working. Thank a lot for the help. I am just curious why exactly we are registering the event consumers on every time we are getting an event ? It will be really helpful if you can clarify.
My code for CircuitBreaker setup:
Logs:
First Request :
Second Request
Third Request
I am not sure, if I am missing something or it is some kind of bug.
Dependency: