Class ZooKeeperUpdatingListenerBuilder

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

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

Examples


 ZooKeeperUpdatingListener listener =
     ZooKeeperUpdatingListener.builder("myZooKeeperHost:2181", "/myProductionEndpoints")
                              .sessionTimeoutMillis(10000)
                              .nodeValueCodec(NodeValueCodec.ofDefault())
                              .build();
 ServerBuilder sb = Server.builder();
 sb.addListener(listener);
 

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.


 ZooKeeperUpdatingListener listener =
     ZooKeeperUpdatingListener.builder(curatorFramework, "/myProductionEndpoints")
                              .nodeValueCodec(NodeValueCodec.DEFAULT)
                              .build();
 ServerBuilder sb = Server.builder();
 sb.addListener(listener);