public void Subscribe() { var w = new watcher(); var zk = new ZooKeeper("", TimeSpan.FromSeconds(1), w); w.WaitUntilConnected(1); zk.GetData("", w, new Stat()); }
public CollectionClusterState GetClusterState(string zkHost, string collectionName) { var w = new watcher(); var zk = new ZooKeeper(zkHost, TimeSpan.FromSeconds(1), w); w.WaitUntilConnected(1); //var nodes = zk.GetChildren("/live_nodes", false).ToList(); var clusterState = zk.GetData("/clusterstate.json", false, null); var json = Encoding.Default.GetString(clusterState); ClusterState state = ClusterState.FromJson(json); return new CollectionClusterState(state.Collections[collectionName]); }
public CollectionClusterState GetClusterState(string zkHost, string collectionName) { var w = new watcher(); var zk = new ZooKeeper(zkHost, TimeSpan.FromSeconds(1), w); w.WaitUntilConnected(1); //var nodes = zk.GetChildren("/live_nodes", false).ToList(); var clusterState = zk.GetData("/clusterstate.json", false, null); var json = Encoding.Default.GetString(clusterState); ClusterState state = ClusterState.FromJson(json); return(new CollectionClusterState(state.Collections[collectionName])); }