Closed rtotaro closed 6 years ago
I found a solution. It is possible to do that using zookeeper as service discovery backend explicitly as in the following:
ServiceDiscoveryOptions serviceDiscoveryOptions = new ServiceDiscoveryOptions();
serviceDiscoveryOptions.setBackendConfiguration(new JsonObject()
.put("backend-name","io.vertx.servicediscovery.backend.zookeeper.ZookeeperBackendService")
.put("connection", "localhost:2181,localhost:2182,localhost:2183")
.put("ephemeral", true)
.put("guaranteed", true)
.put("basePath", "/services/discovery"));
ServiceDiscovery discovery = ServiceDiscovery.create(vertx, serviceDiscoveryOptions);
You need also this dependency:
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-service-discovery-backend-zookeeper</artifactId>
<version>3.5.1</version>
</dependency>
Record object used by Vertx service discovery is converted into a JsonObject and then in a String before saving it in zookeeper but it is saved as a java serialized object and not as a simple string. (see io.vertx.spi.cluster.zookeeper.impl.ZKMap#asByte)
This behaviour does not allow reading information about registered services on zookeeper by not java software. Is it right? Can you suggest me some workaround?