# Zookeeper Configuration Store

The Zookeeper Configuration Store extends the Vert.x Configuration Retriever and provides the way to retrieve configuration from a Zookeeper server.

It uses Apache Curator as client.

## Using the Zookeeper Configuration Store

To use the Redis Configuration Store, add the following dependency to the dependencies section of your build descriptor:

- Maven (in your `pom.xml`):

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-config-zookeeper</artifactId>
      <version>3.4.0.Beta1</version>
    </dependency>
    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-config</artifactId>
      <version>3.4.0.Beta1</version>
    </dependency>

- Gradle (in your `build.gradle` file):

    compile 'io.vertx:vertx-config:3.4.0.Beta1'
    compile 'io.vertx:vertx-config-zookeeper:3.4.0.Beta1'

## Configuring the store

Once added to your classpath or dependencies, you need to configure the `ConfigRetriever` to use this store:

    import io.vertx.config.ConfigRetriever
    def store = [
      type:"zookeeper",
      config:[
        connection:"localhost:2181",
        path:"/path/to/my/conf"
      ]
    ]

    def retriever = ConfigRetriever.create(vertx, [
      stores:[
        store
      ]
    ])

The store configuration is used to configure the Apache Curator client and the path of the Zookeeper node containing the configuration. Notice that the format of the configuration can be JSON, or any supported format.

The configuration requires the `configuration` attribute indicating the connection string of the Zookeeper server, and the `path` attribute indicating the path of the node containing the configuration.

In addition you can configure:

- `maxRetries`: the number of connection attempt, 3 by default

- `baseSleepTimeBetweenRetries`: the amount of milliseconds to wait between retries (exponential backoff strategy). 1000 ms by default.