Updated docs

This commit is contained in:
Marcin Grzejszczak
2016-03-10 14:38:22 +01:00
parent 99a349b194
commit 75e9d6fcd0

View File

@@ -82,7 +82,11 @@ public String serviceUrl() {
----
[[spring-cloud-zookeeper-dependencies]]
== Zookeeper Dependencies
=== Using the Zookeeper Dependencies
Spring Cloud Zookeeper gives you a possibility to provide dependencies of your application as properties. As dependencies you can understand other applications that are registered
in Zookeeper and which you would like to call via https://github.com/spring-cloud/spring-cloud-netflix/blob/master/docs/src/main/asciidoc/spring-cloud-netflix.adoc#spring-cloud-feign[Feign] (a REST client builder)
and also https://github.com/spring-cloud/spring-cloud-netflix/blob/master/docs/src/main/asciidoc/spring-cloud-netflix.adoc#spring-cloud-ribbon[Spring `RestTemplate`].
@@ -96,6 +100,7 @@ You can also benefit from the Zookeeper Dependency Watchers functionality that l
- You have to have the `spring.cloud.zookeeper.dependencies` section properly set up - check the subsequent section for more details.
=== Setting up Zookeeper Dependencies
Let's take a closer look at an example of dependencies representation:
.application.yml
@@ -213,7 +218,7 @@ In other words your application won't be able to start if the required dependenc
You can read more about Spring Cloud Zookeeper Presence Checker in the following sections.
=== Stubs
==== Stubs
You can provide a colon separated path to the JAR containing stubs of the dependency. Example
@@ -252,7 +257,8 @@ headers and content type with version set in Dependency configuration. Wihtout t
[[spring-cloud-zookeeper-dependency-watcher]]
=== Spring Cloud Zookeeper Dependency Watcher
== Spring Cloud Zookeeper Dependency Watcher
The Dependency Watcher mechanism allows you to register listeners to your dependencies. The functionality is in fact an implementation of the `Observator` pattern. When a dependency changes
its state (UP or DOWN) then some custom logic can be applied.
@@ -267,12 +273,6 @@ In order to register a listener you have to implement an interface `org.springfr
The interface gives you one method:
----
/**
* Method executed upon state change of a dependency
*
* @param dependencyName - alias from microservice configuration {@see ZookeeperDependencies}
* @param newState
*/
void stateChanged(String dependencyName, DependencyState newState);
----
@@ -294,6 +294,7 @@ The functionality can be overriden since the `DefaultDependencyPresenceOnStartup
[[spring-cloud-zookeeper-config]]
== Distributed Configuration with Zookeeper
Zookeeper provides a http://zookeeper.apache.org/doc/current/zookeeperOver.html#sc_dataModelNameSpace[hierarchical namespace] that allows clients to store arbitrary data, such as configuration data. Spring Cloud Zookeeper Config is an alternative to the https://github.com/spring-cloud/spring-cloud-config[Config Server and Client]. Configuration is loaded into the Spring Environment during the special "bootstrap" phase. Configuration is stored in the `/config` namespace by default. Multiple `PropertySource` instances are created based on the application's name and the active profiles that mimicks the Spring Cloud Config order of resolving properties. For example, an application with the name "testApp" and with the "dev" profile will have the following property sources created: