{"id":19990788,"url":"https://github.com/stulzq/NZookeeper","last_synced_at":"2025-05-04T10:30:44.793Z","repository":{"id":88591080,"uuid":"312538532","full_name":"stulzq/NZookeeper","owner":"stulzq","description":"A zookeeper client library based on ZookeeperEx，easily use for Zookeeper.","archived":false,"fork":false,"pushed_at":"2023-02-27T09:25:05.000Z","size":33,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-27T09:43:50.292Z","etag":null,"topics":["zookeeper","zookeeper-client"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stulzq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-13T10:02:26.000Z","updated_at":"2022-01-20T05:51:14.000Z","dependencies_parsed_at":"2023-03-10T22:45:23.981Z","dependency_job_id":null,"html_url":"https://github.com/stulzq/NZookeeper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FNZookeeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FNZookeeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FNZookeeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FNZookeeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stulzq","download_url":"https://codeload.github.com/stulzq/NZookeeper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252319973,"owners_count":21729047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["zookeeper","zookeeper-client"],"created_at":"2024-11-13T04:51:28.366Z","updated_at":"2025-05-04T10:30:44.310Z","avatar_url":"https://github.com/stulzq.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# NZookeeper\n[![Latest version](https://img.shields.io/nuget/v/NZookeeper.svg)](https://www.nuget.org/packages/NZookeeper/) \n\nEnglish|[中文](README_zh-CN.md)\n\nA zookeeper client library based on ZookeeperEx，easily use for Zookeeper.\n\n\u003e Transaction operation is not supported at present, and will be supported in the next version\n\n## Get start\n\n1.Connect to Zookeeper\n\n````csharp\nusing var loggerFactory = LoggerFactory.Create(builder =\u003e\n            {\n                builder\n                    .AddFilter(\"Microsoft\", LogLevel.Debug)\n                    .AddFilter(\"System\", LogLevel.Information)\n                    .AddConsole();\n            });\nvar logger = loggerFactory.CreateLogger\u003cZkConnection\u003e();\n//Multiple zookeeper addresses are separated by ,\nvar zk = new ZkConnection(new ZkConnectionOptions() { ConnectionString = \"localhost:2181\", SessionTimeout = 5000 }, logger);\nawait zk.ConnectAsync();\n````\n\n2.Set watch event\n\n\u003e It is used to monitor node changes and data changes. Node changes include: node creation and node deletion\n\n````csharp\nzk.OnWatch += Zk_OnWatch;\n\nprivate Task Zk_OnWatch(ZkWatchEventArgs args)\n{\n    Console.WriteLine($\"OnWatch: Path {args.Path}, Type {args.EventType}, State {args.State}\");\n    return Task.CompletedTask;\n}\n````\n\n3.Node operation\n\n````csharp\n//Create node\nawait zk.CreateNodeAsync(\"/mynode\", \"nodedata\",\n                    new List\u003cAcl\u003e() { new Acl(AclPerm.All, AclScheme.World, AclId.World()) }, NodeType.Ephemeral);\n//Get child node\nawait zk.GetChildrenAsync(\"/mynode\");\n//Delete node\nawait zk.DeleteNodeAsync(\"/mynode\");\n//Check if the node exists\nawait zk.NodeExistsAsync(\"/mynode\")\n````\n\n4.Data\n\n````csharp\n//Update node data\nawait zk.SetDataAsync(\"/mynode\", \"111\");\n//Get node data\nawait zk.GetDataAsync(\"/mynode\")\n````\n\n5.ACL\n\n````csharp\n//Get ACL\nawait zk.GetAclAsync(\"/mynode\");\n//Set ACL\nawait zk.SetAclAsync(\"/mynode\",new List\u003cAcl\u003e() { new Acl(AclPerm.All, AclScheme.World, AclId.World()) })\n````\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstulzq%2FNZookeeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstulzq%2FNZookeeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstulzq%2FNZookeeper/lists"}