Nacos客户端
NacosNamingService這個類實現了服務的注冊,同時也實現了服務心跳:
@Override public void registerInstance(String serviceName, String groupName, Instance instance) throws NacosException {NamingUtils.checkInstanceIsLegal(instance);String groupedServiceName = NamingUtils.getGroupedName(serviceName, groupName);// 判斷是否是臨時實例。if (instance.isEphemeral()) {// 如果是臨時實例,則構建心跳信息BeatInfoBeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance);// 添加心跳任務beatReactor.addBeatInfo(groupedServiceName, beatInfo);}serverProxy.registerService(groupedServiceName, groupName, instance); }總結
- 上一篇: Nacos服务心跳
- 下一篇: Nacos源码BeatInfo