the eurekaEventListener implementation class code:
public class EurekaServerListProcessor implements ServerListProcessor<Server>, EurekaEventListener {
private static final Logger log = LoggerFactory.getLogger(EurekaServerListProcessor.class);
private EurekaClient eurekaClient;
private Map<String, List<Server>> serversMap = new ConcurrentHashMap<>();
public EurekaServerListProcessor(GrayHoldoutServerProperties grayHoldoutServerProperties, EurekaClient eurekaClient) {
this.eurekaClient = eurekaClient;
eurekaClient.registerEventListener(this);
}
@Override
public List<Server> process(String serviceId, List<Server> servers) {
return servers;
}
@Override
public void onEvent(EurekaEvent event) {
log.debug("接收到eureka事件:{}, 刷新缓存的server list", event);
serversMap.clear();
}
}
Comment From: ryanjbaxter
This does not describe the problem
Comment From: saleson
This problem triggering process of First step is custom EurekaEventListener sccuess registerd to DiscoveryClient when spring container started, and after a period of normal operation, application triggered EnvironmentChangeEvent, after DiscoveryClient reinitialization, the custom EurekaEventListener is cant receive EurekaEvent, The reason is this custom EurekaEventListener is not Re-register to the DiscoveryClient.
Comment From: spencergibb
Closing this due to inactivity. Please re-open if there's more to discuss.