Implements getServiceId

This commit is contained in:
Spencer Gibb
2017-02-01 13:22:59 -07:00
parent c6fee690ab
commit b9c2b88bbb
2 changed files with 13 additions and 0 deletions

View File

@@ -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

View File

@@ -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;