Example #1
0
        private void EnsureZooKeeperPath(string topic, string address)
        {
            if (!_client.EnsureExists("/", false))
            {
                _client.EnsureCreate("/");
            }
            var root = BuildZooKeeperPath();

            if (!_client.EnsureExists(root, false))
            {
                _client.EnsureCreate(root);
            }
            var levelTopic = BuildZooKeeperPath(topic);

            if (!_client.EnsureExists(levelTopic, false))
            {
                _client.EnsureCreate(levelTopic);
            }

            var levelAddress = BuildZooKeeperPath(topic, address);

            if (!_client.EnsureExists(levelAddress, false))
            {
                _client.EnsureCreate(levelAddress);
            }
        }
        private void EnsureZooKeeperPath(string configName, Version ver, string envKey, string key)
        {
            if (!_client.EnsureExists("/", false))
            {
                _client.EnsureCreate("/");
            }
            var root = BuildZooKeeperPath();

            if (!_client.EnsureExists(root, false))
            {
                _client.EnsureCreate(root);
            }
            var levelName = BuildZooKeeperPath(configName);

            if (!_client.EnsureExists(levelName, false))
            {
                _client.EnsureCreate(levelName);
            }

            var levelVer = BuildZooKeeperPath(configName, ver);

            if (!_client.EnsureExists(levelVer, false))
            {
                _client.EnsureCreate(levelVer);
            }
            var levelEnv = BuildZooKeeperPath(configName, ver, envKey);

            if (!_client.EnsureExists(levelEnv, false))
            {
                _client.EnsureCreate(levelEnv);
            }

            var levelValue = BuildZooKeeperPath(configName, ver, envKey, key);

            if (!_client.EnsureExists(levelValue, false))
            {
                _client.EnsureCreate(levelValue);
            }
        }