Open hmantri05 opened 2 years ago
Hi why don't you use the Spring Boot starter and external configuration? Did you have a look at the demo?
See link for event consumer registration.
@RobWin So we have an internal tool (CCM) where we keep the configs and which can be changed at runtime as well. The hardcoded values that I have shown in the above screenshot, I am going to feed those values from our CCM config classes. So I can't use the application.properties config here.
Cannot you make use of Spring Cloud Config instead? It allows the reconfiguration at runtime. Otherwise how do you trigger a reconfiguration in Spring Boot?
@RobWin So the application keeps on polling the CCM to see if there are any changes every minute. It's a company wide used tool. Inhouse built.
But how do you refresh the Registry? Do you replace the CircuitBreaker instances?
@RobWin The current use case is to have four diffent configs with which we can initialize the circuit breakers. For now there is no need to refresh the config at runtime. But that's a valid point. May be you can suggest something around refreshing the circuit breakers live as well. :D
I would propose to use Spring Cloud Config and build an adapter around your internal CCM tool. Use the external config file to configure your 4 CircuitBreakers.
I have created a @Bean of CircuitBreakerRegistry and have annotated four different methods using @CircuitBreaker annotation. All have different names.
I want to keep 4 different kinds of CircuitBreakerConfig in the registry for each of the circuit breaker.
How can I achieve this?
Also, I want to log every event on these four CircuitBreakers. I know we can achieve that using:
registry.circuitBreaker(name).getEventPublisher().onEvent(logger)
But how do I get hold of the reference to those four circuit breakers?
@RobWin