/// <summary>
 /// make sure a persistent path exists in ZK. Create the path if not exist.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="path"></param>
 public static void MakeSurePersistentPathExists(ZkClient client, string path)
 {
     if (!client.Exists(path))
     {
         client.CreatePersistent(path, true); // won't throw NoNodeException or NodeExistsException
     }
 }
        public static void CreateOrUpdateTopicPartitionAssignmentPathInZK(
            ZkClient zkClient,
            string topic,
            Dictionary <int, List <int> > partitionReplicaAssignment,
            Dictionary <string, string> config,
            bool update = false)
        {
            // Note: validation was omited
            var topicPath = ZkUtils.GetTopicPath(topic);

            if (!update && zkClient.Exists(topicPath))
            {
                throw new KafkaException("Topic " + topic + " already exists.");
            }

            // write out the config if there is any, this isn't transactional with the partition assignments
            WriteTopicConfig(zkClient, topic, config);

            // create the partition assignment
            WriteTopicPartitionAssignment(zkClient, topic, partitionReplicaAssignment, update);
        }
Пример #3
0
         public static void CreateOrUpdateTopicPartitionAssignmentPathInZK(
             ZkClient zkClient,
             string topic,
             Dictionary<int, List<int>> partitionReplicaAssignment,
             Dictionary<string, string> config,
             bool update = false)
         {

             // Note: validation was omited
             var topicPath = ZkUtils.GetTopicPath(topic);
             if (!update && zkClient.Exists(topicPath))
             {
                 throw new KafkaException("Topic " + topic +" already exists.");
             }

             // write out the config if there is any, this isn't transactional with the partition assignments
             WriteTopicConfig(zkClient, topic, config);
    
            // create the partition assignment
             WriteTopicPartitionAssignment(zkClient, topic, partitionReplicaAssignment, update);
         }
Пример #4
0
 public static bool PathExists(ZkClient client, string path)
 {
     return client.Exists(path);
 }
Пример #5
0
 /// <summary>
 /// make sure a persistent path exists in ZK. Create the path if not exist.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="path"></param>
 public static void MakeSurePersistentPathExists(ZkClient client, string path)
 {
     if (!client.Exists(path))
     {
         client.CreatePersistent(path, true); // won't throw NoNodeException or NodeExistsException
     }
 }
 public static bool PathExists(ZkClient client, string path)
 {
     return(client.Exists(path));
 }