/// <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); }
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); }
public static bool PathExists(ZkClient client, string path) { return client.Exists(path); }
public static bool PathExists(ZkClient client, string path) { return(client.Exists(path)); }