|
|
@ -437,8 +437,8 @@ public void registerService(String serviceName, String groupName, Instance insta
|
|
|
|
namespaceId, serviceName, instance);
|
|
|
|
namespaceId, serviceName, instance);
|
|
|
|
String groupedServiceName = NamingUtils.getGroupedName(serviceName, groupName);
|
|
|
|
String groupedServiceName = NamingUtils.getGroupedName(serviceName, groupName);
|
|
|
|
if (instance.isEphemeral()) {
|
|
|
|
if (instance.isEphemeral()) {
|
|
|
|
BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance);
|
|
|
|
BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance);
|
|
|
|
beatReactor.addBeatInfo(groupedServiceName, beatInfo);
|
|
|
|
beatReactor.addBeatInfo(groupedServiceName, beatInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final Map<String, String> params = new HashMap<String, String>(32);
|
|
|
|
final Map<String, String> params = new HashMap<String, String>(32);
|
|
|
@ -660,29 +660,29 @@ public Instance getInstance(String namespaceId, String serviceName, String clust
|
|
|
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, switchDomain.getClientBeatInterval());
|
|
|
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, switchDomain.getClientBeatInterval());
|
|
|
|
RsInfo clientBeat = null;
|
|
|
|
RsInfo clientBeat = null;
|
|
|
|
if (StringUtils.isNotBlank(beat)) {
|
|
|
|
if (StringUtils.isNotBlank(beat)) {
|
|
|
|
clientBeat = JacksonUtils.toObj(beat, RsInfo.class);
|
|
|
|
clientBeat = JacksonUtils.toObj(beat, RsInfo.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (clientBeat != null) {
|
|
|
|
if (clientBeat != null) {
|
|
|
|
if (StringUtils.isNotBlank(clientBeat.getCluster())) {
|
|
|
|
if (StringUtils.isNotBlank(clientBeat.getCluster())) {
|
|
|
|
clusterName = clientBeat.getCluster();
|
|
|
|
clusterName = clientBeat.getCluster();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// fix #2533
|
|
|
|
// fix #2533
|
|
|
|
clientBeat.setCluster(clusterName);
|
|
|
|
clientBeat.setCluster(clusterName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ip = clientBeat.getIp();
|
|
|
|
ip = clientBeat.getIp();
|
|
|
|
port = clientBeat.getPort();
|
|
|
|
port = clientBeat.getPort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NamingUtils.checkServiceNameFormat(serviceName);
|
|
|
|
NamingUtils.checkServiceNameFormat(serviceName);
|
|
|
|
Loggers.SRV_LOG.debug("[CLIENT-BEAT] full arguments: beat: {}, serviceName: {}, namespaceId: {}", clientBeat,
|
|
|
|
Loggers.SRV_LOG.debug("[CLIENT-BEAT] full arguments: beat: {}, serviceName: {}, namespaceId: {}", clientBeat,
|
|
|
|
serviceName, namespaceId);
|
|
|
|
serviceName, namespaceId);
|
|
|
|
BeatInfoInstanceBuilder builder = BeatInfoInstanceBuilder.newBuilder();
|
|
|
|
BeatInfoInstanceBuilder builder = BeatInfoInstanceBuilder.newBuilder();
|
|
|
|
int resultCode = instanceServiceV2
|
|
|
|
int resultCode = instanceServiceV2
|
|
|
|
.handleBeat(namespaceId, serviceName, ip, port, clusterName, clientBeat, builder);
|
|
|
|
.handleBeat(namespaceId, serviceName, ip, port, clusterName, clientBeat, builder);
|
|
|
|
result.put(CommonParams.CODE, resultCode);
|
|
|
|
result.put(CommonParams.CODE, resultCode);
|
|
|
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL,
|
|
|
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL,
|
|
|
|
instanceServiceV2.getHeartBeatInterval(namespaceId, serviceName, ip, port, clusterName));
|
|
|
|
instanceServiceV2.getHeartBeatInterval(namespaceId, serviceName, ip, port, clusterName));
|
|
|
|
result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled());
|
|
|
|
result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled());
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
```
|
|
|
|