NacosServiceInstance.getInstanceId() is null

pull/2375/head
galaxy 3 years ago
parent 8719706e46
commit 5986556b6b

@ -24,11 +24,14 @@ import org.springframework.cloud.client.ServiceInstance;
/**
* @author xiaojing
* @author changjin wei()
*/
public class NacosServiceInstance implements ServiceInstance {
private String serviceId;
private String instanceId;
private String host;
private int port;
@ -42,6 +45,11 @@ public class NacosServiceInstance implements ServiceInstance {
return serviceId;
}
@Override
public String getInstanceId() {
return instanceId;
}
@Override
public String getHost() {
return host;
@ -71,6 +79,10 @@ public class NacosServiceInstance implements ServiceInstance {
this.serviceId = serviceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public void setHost(String host) {
this.host = host;
}

@ -33,6 +33,7 @@ import org.springframework.cloud.client.ServiceInstance;
/**
* @author <a href="mailto:echooy.mxq@gmail.com">echooymxq</a>
* @author changjin wei()
**/
public class NacosServiceDiscovery {
@ -92,6 +93,7 @@ public class NacosServiceDiscovery {
nacosServiceInstance.setHost(instance.getIp());
nacosServiceInstance.setPort(instance.getPort());
nacosServiceInstance.setServiceId(serviceId);
nacosServiceInstance.setInstanceId(instance.getInstanceId());
Map<String, String> metadata = new HashMap<>();
metadata.put("nacos.instanceId", instance.getInstanceId());

Loading…
Cancel
Save