You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZookeeperAutoServiceRegistration throws an exception when ServiceInstanceRegistration method getServiceInstance() is called before ZookeeperAutoServiceRegistration method getPort()
It happens because method getServiceInstance() calls build() and when getPort() will be called it will return null instead 0.
Use case when we need to call getServiceInstance for example to create leader candidate and associate with registration id for further understanding which node is a leader.
@Bean
public DefaultCandidate bean(ServiceInstanceRegistration registration) {
return return new DefaultCandidate(registration.getServiceInstance().getId(), "default");
}
The text was updated successfully, but these errors were encountered:
ZookeeperAutoServiceRegistration throws an exception when ServiceInstanceRegistration method getServiceInstance() is called before ZookeeperAutoServiceRegistration method getPort()
It happens because method
getServiceInstance()
callsbuild()
and whengetPort()
will be called it will return null instead 0.spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 64 to 69 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 71 to 73 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ServiceInstanceRegistration.java
Lines 83 to 88 in ec845a4
spring-cloud-zookeeper/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistration.java
Lines 70 to 79 in ec845a4
Also
getInstanceId()
method returns null.Use case when we need to call
getServiceInstance
for example to create leader candidate and associate with registration id for further understanding which node is a leader.The text was updated successfully, but these errors were encountered: