Exemplo n.º 1
0
        public void Init()
        {
            var zkOptions = new ZkOptions
            {
                ZkServers            = "114.215.169.82:12181",
                SessionTimeout       = 1000 * 100,
                ConnectionTimeout    = 1000 * 5,
                OprationRetryTimeout = 1000 * 100
            };

            _zkClient = new ZkClient(zkOptions);
            _zkClient.SubscribeStateChange(new ZkStateListener());
            _zkClient.SubscribeChildChange("/data", new ZkChildListener());
            _zkClient.SubscribeDataChange("/data", new ZkDataListener());
            _zkClient.CreatePersistent("/data").GetAwaiter().GetResult();
        }