The service of the eureka client is offline after using refreshAll
or refresh(beanName)
.
My troubleshooting conclusion is that executing the refreshAll()
or refresh(beanName)
method will trigger multiple StatusChangeEvents
and call the instance. 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 the RefreshScopeRefreshedEvent
event.
So are there two things to consider?
1)If I set the configuration refresh to false
: eureka.client.refresh.enable=false
,then EurekaClientConfigurationRefresher
should not receive the RefreshScopeRefreshedEvent
event
2)If EurekaClientConfigurationRefresher
receives the RefreshScopeRefreshedEvent
event, it should do a layer of filtering, such as whether the event name is Eureka
Comment From: spencergibb
Are you trying to disable refresh of a running application?
Comment From: yonyong
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?
Comment From: yonyong
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
Comment From: chenguanglee
I also encountered such a problem
Comment From: yonyong
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.