in client/Apache.ShenYu.Client/Utils/Zookeeper/ZookeeperClient.cs [214:245]
public async Task<bool> CreateWithParentAsync(string path, byte[] data, List<ACL> acls, CreateMode createMode)
{
path = GetZooKeeperPath(path);
return await RetryUntilConnected(async () =>
{
var paths = path.Trim('/').Split('/');
var cur = "";
foreach (var item in paths)
{
if (string.IsNullOrEmpty(item))
{
continue;
}
cur += $"/{item}";
var existStat = await _zookeeperClient.existsAsync(cur, null);
if (existStat != null)
{
continue;
}
if (cur.Equals(path))
{
await _zookeeperClient.createAsync(cur, data, acls, createMode);
}
else
{
await _zookeeperClient.createAsync(cur, null, acls, createMode);
}
}
return await Task.FromResult(true);
});
}