Class ZooKeeperUpdatingListenerBuilder

java.lang.Object
com.linecorp.armeria.common.zookeeper.AbstractCuratorFrameworkBuilder
com.linecorp.armeria.server.zookeeper.ZooKeeperUpdatingListenerBuilder

public final class ZooKeeperUpdatingListenerBuilder
extends AbstractCuratorFrameworkBuilder
Builds a new ZooKeeperUpdatingListener, which registers the server to a ZooKeeper cluster.

 ZooKeeperRegistrationSpec spec = ZooKeeperRegistrationSpec.curator("myServices");
 ZooKeeperUpdatingListener listener =
     ZooKeeperUpdatingListener.builder("myZooKeeperHost:2181", "/myProductionEndpoints", spec)
                              .sessionTimeoutMillis(10000)
                              .build();
 ServerBuilder sb = Server.builder();
 sb.serverListener(listener);
 
This registers the Server using the format compatible with Curator Service Discovery.

You can also specify the CuratorFramework instance to use. In this case, invoking connectTimeout(Duration), connectTimeoutMillis(long), sessionTimeout(Duration) or sessionTimeoutMillis(long) will raise an IllegalStateException.


 ZooKeeperRegistrationSpec spec = ...
 ZooKeeperUpdatingListener listener =
     ZooKeeperUpdatingListener.builder(curatorFramework, "/myProductionEndpoints", spec)
                              .build();
 ServerBuilder sb = Server.builder();
 sb.serverListener(listener);