### Zookeeper bridge

This discovery bridge imports services from Apache Zookeeper into the Vert.x service discovery. The bridge uses the Curator extension for service discovery.

Service description are read as JSON Object (merged in the Vert.x service record metadata). The service type is deduced from this description by reading the `service-type`.

#### Using the bridge

To use this Vert.x discovery bridge, add the following dependency to the dependencies section of your build descriptor:

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

    <dependency>
     <groupId>io.vertx</groupId>
     <artifactId>vertx-service-discovery-bridge-zookeeper</artifactId>
     <version>4.3.0</version>
    </dependency>

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

    compile 'io.vertx:vertx-service-discovery-bridge-zookeeper:4.3.0'

Then, when creating the service discovery registers this bridge as follows:

    ServiceDiscovery.create(vertx)
        .registerServiceImporter(new ZookeeperServiceImporter(),
            new JsonObject()
                .put("connection", "127.0.0.1:2181"));

Only the `connection` configuration is mandatory. It’s the connection string of the Zookeeper server.

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.

- `basePath`: the Zookeeper path in which the service are stored. Default to `/discovery`.

- `connectionTimeoutMs`: the connection timeout in milliseconds. Defaults to 1000.

- `canBeReadOnly` : whether or not the backend support the read-only mode (defaults to true)

    ServiceDiscovery.create(vertx)
        .registerServiceImporter(new ZookeeperServiceImporter(),
            new JsonObject()
                .put("connection", "127.0.0.1:2181")
                .put("maxRetries", 5)
                .put("baseSleepTimeBetweenRetries", 2000)
                .put("basePath", "/services")
        );