diff --git a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/ZookeeperServiceDiscovery.java b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/ZookeeperServiceDiscovery.java index a7233196..339b22c0 100644 --- a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/ZookeeperServiceDiscovery.java +++ b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/discovery/ZookeeperServiceDiscovery.java @@ -102,6 +102,11 @@ public class ZookeeperServiceDiscovery implements ZookeeperRegistration, Applica this.appName = resolver.getProperty("spring.application.name", "application"); } + @Override + public String getServiceId() { + return this.appName; + } + /** * Builds Service Instance - needs to be used when you want to register your application * in Zookeeper diff --git a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java index 901f6786..36a8485f 100644 --- a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java +++ b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java @@ -130,6 +130,14 @@ public class ServiceInstanceRegistration implements ZookeeperRegistration { this.serviceInstance = this.builder.build(); } + @Override + public String getServiceId() { + if (this.serviceInstance == null) { + return null; + } + return this.serviceInstance.getName(); + } + public int getPort() { if (this.serviceInstance == null) { return 0;