chroot with ZooKeeperClient?
Looking at the ZooKeeperClient api (and also the implementation), it looks like there's no way to connect to the zk cluster using a chroot suffix, which I typically do just by specifying the zk connect string directly, e.g.
"host-a,host-b,host-c/prod/service"
Ack - this would be a nice improvement. Definitely happy to take a patch if you're willing.
Sure. How about another constructor that takes the zk connect string directly? Something like:
public ZooKeeperClient(Amount<Integer, Time> sessionTimeout, Credentials credentials, String zooKeeperServers) {
...
this.zooKeeperServers = zooKeeperServers;
}
In my experience those strings are specified as-is in the config, so I'm not sure if there's much advantage to trying to split it all up into hosts and ports and chroots, rather than just passing through the string directly and letting the ZooKeeper constructor complain if it can't parse it.
I'd prefer an additional chroot argument overload too to keep with the existing style - reasoning going like this: Most internal usages use the Arg parsing facility to parse Arg<List<InetSocketAddress>> at startup - validation can fail fast here. The actual ZooKeeper client is then often created later in a background thread.
Ok, sounds good to me. I'll submit a pull request.
Pull requested: #53.