Example #1
0
var connector = async.memoize(function(servers, next) {
    var client = zkplus.createClient({
        servers: servers,
        timeout: 1000
    });
    client.on("connect", function() {
        next(null, client);
    });
});
Example #2
0
        function _zk(_, cb) {
            cb = once(cb);

            var zk = zkplus.createClient(cfg.zookeeper);

            zk.once('connect', function () {
                zk.removeAllListeners('error');
                LOG.info({
                    zk: zk.toString()
                }, 'ZooKeeper client acquired');

                cb(null, zk);
            });

            zk.once('error', function (err) {
                zk.removeAllListeners('connect');
                cb(err);
            });

            zk.connect();
        }