Open yonyong opened 1 year ago
Are you trying to disable refresh of a running application?
Are you trying to disable refresh of a running application? ^_^ That's not it.
We use Apollo as our configuration hub and hot updates to our configuration are done using springcloud's refreshScope.refreshAll()
. But the refreshAll
method will rebuild the eureka bean and re-register to eureka server, which is not what we want, we just want to refresh a business configuration item.
So I tried to configure eureka.client.refresh.enabled=false
and restarted the project.
But I found that org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration.EurekaClientConfigurationRefresher
The onApplicationEvent
method still receives the RefreshScopeRefreshedEvent
event fired by refreshAll
and performs an eureka reregistration. I don't think the design is quite right, is it?
I think when configure eureka.client.refresh.enable=false,this listener should be turned off as well. Otherwise a single call to refreshAll will trigger a re-registration of eureka here
I also encountered such a problem
I think this should be a problem with the eureka implementation. Just turn off the eureka refresh listener, see my fix package for details: https://github.com/yonyong/spring-cloud-netflix-eureka-patch.
The service of the eureka client is offline after using
refreshAll
orrefresh(beanName)
. My troubleshooting conclusion is that executing therefreshAll()
orrefresh(beanName)
method will trigger multipleStatusChangeEvents
and call theinstance. setStatus()
method in parallel to modify the instance status. My idea is to disable eureka refresh, but after turning off the configuration, the application can still receive theRefreshScopeRefreshedEvent
event. So are there two things to consider? 1)If I set the configuration refresh tofalse
:eureka.client.refresh.enable=false
,thenEurekaClientConfigurationRefresher
should not receive theRefreshScopeRefreshedEvent
event 2)IfEurekaClientConfigurationRefresher
receives theRefreshScopeRefreshedEvent
event, it should do a layer of filtering, such as whether the event name is Eureka