diff --git a/docs/pom.xml b/docs/pom.xml index 26923c8a..205e0eb9 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -38,11 +38,9 @@ git-commit-id-plugin - org.apache.maven.plugins maven-dependency-plugin - org.apache.maven.plugins maven-resources-plugin @@ -54,7 +52,6 @@ asciidoctor-maven-plugin - org.apache.maven.plugins maven-antrun-plugin diff --git a/docs/src/main/asciidoc/_configprops.adoc b/docs/src/main/asciidoc/_configprops.adoc index e00f992e..db1b8dc2 100644 --- a/docs/src/main/asciidoc/_configprops.adoc +++ b/docs/src/main/asciidoc/_configprops.adoc @@ -6,7 +6,8 @@ |spring.cloud.zookeeper.block-until-connected-wait | 10 | Wait time to block on connection to Zookeeper. |spring.cloud.zookeeper.connect-string | localhost:2181 | Connection string to the Zookeeper cluster. |spring.cloud.zookeeper.connection-timeout | | The configured connection timeout in milliseconds. -|spring.cloud.zookeeper.dependencies | | Mapping of alias to ZookeeperDependency. From LoadBalancer perspective the alias is actually serviceID since SC LoadBalancer can't accept nested structures in serviceID. +|spring.cloud.zookeeper.default-health-endpoint | | Default health endpoint that will be checked to verify that a dependency is alive. +|spring.cloud.zookeeper.dependencies | | Mapping of alias to ZookeeperDependency. From Ribbon perspective the alias is actually serviceID since Ribbon can't accept nested structures in serviceID. |spring.cloud.zookeeper.dependency-configurations | | |spring.cloud.zookeeper.dependency-names | | |spring.cloud.zookeeper.discovery.enabled | true | diff --git a/docs/src/main/asciidoc/sagan-index.adoc b/docs/src/main/asciidoc/sagan-index.adoc index 8c230337..f6e45cd2 100644 --- a/docs/src/main/asciidoc/sagan-index.adoc +++ b/docs/src/main/asciidoc/sagan-index.adoc @@ -36,4 +36,4 @@ public class Application { } ``` -A local Zookeeper server must be running. See the http://zookeeper.apache.org/doc/trunk/zookeeperStarted.html[Zookeeper documentation] on how to run a Zookeeper server. +A local Zookeeper server must be running. See the http://zookeeper.apache.org/[Zookeeper documentation] on how to run a Zookeeper server. diff --git a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java index e8a97881..4723ede9 100644 --- a/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java +++ b/spring-cloud-zookeeper-discovery/src/main/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationAutoConfiguration.java @@ -26,6 +26,7 @@ import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryAutoConfi import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties; import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance; import org.springframework.cloud.zookeeper.serviceregistry.ServiceInstanceRegistration.RegistrationBuilder; +import org.springframework.cloud.zookeeper.support.StatusConstants; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -61,6 +62,8 @@ public class ZookeeperAutoServiceRegistrationAutoConfiguration { throw new IllegalStateException("instanceHost must not be empty"); } + properties.getMetadata().put(StatusConstants.INSTANCE_STATUS_KEY, properties.getInitialStatus()); + ZookeeperInstance zookeeperInstance = new ZookeeperInstance(context.getId(), appName, properties.getMetadata()); RegistrationBuilder builder = ServiceInstanceRegistration.builder().address(host) diff --git a/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java b/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java index f3ba7af5..b87df39c 100644 --- a/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java +++ b/spring-cloud-zookeeper-discovery/src/test/java/org/springframework/cloud/zookeeper/serviceregistry/ZookeeperAutoServiceRegistrationTests.java @@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.zookeeper.discovery.ZookeeperDiscoveryProperties; import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance; import org.springframework.cloud.zookeeper.discovery.test.CommonTestConfig; +import org.springframework.cloud.zookeeper.support.StatusConstants; import org.springframework.context.annotation.Import; import org.springframework.test.context.junit4.SpringRunner; @@ -41,7 +42,9 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen */ @RunWith(SpringRunner.class) @SpringBootTest(properties = { - "spring.application.name=myTestService1-F" }, webEnvironment = RANDOM_PORT) + "spring.application.name=myTestService1-F", + "spring.cloud.zookeeper.discovery.initial-status=OUT_OF_SERVICE" +}, webEnvironment = RANDOM_PORT) public class ZookeeperAutoServiceRegistrationTests { @Autowired @@ -62,6 +65,8 @@ public class ZookeeperAutoServiceRegistrationTests { ServiceInstance instance = instances.iterator().next(); assertThat(instance).isNotNull(); assertThat(instance.getName()).isEqualTo("myTestService1-F"); + assertThat(instance.getPayload().getMetadata().get(StatusConstants.INSTANCE_STATUS_KEY)) + .isEqualTo(StatusConstants.STATUS_OUT_OF_SERVICE); /* * Response> response = consul.getAgentServices(); * Map services = response.getValue(); Service service =