internal void RegisterConsumerInZk(ZKGroupDirs dirs, string consumerIdString, TopicCount topicCount) { this.EnsuresNotDisposed(); Logger.InfoFormat(CultureInfo.CurrentCulture, "begin registering consumer {0} in ZK", consumerIdString); ZkUtils.CreateEphemeralPathExpectConflict(this.zkClient, dirs.ConsumerRegistryDir + "/" + consumerIdString, topicCount.ToJsonString()); Logger.InfoFormat(CultureInfo.CurrentCulture, "end registering consumer {0} in ZK", consumerIdString); }
internal void RegisterConsumerInZk(ZKGroupDirs dirs, string consumerIdString, TopicCount topicCount) { this.EnsuresNotDisposed(); Logger.InfoFormat("begin registering consumer {0} in ZK", consumerIdString); try { this.GetZkClient().SlimLock.EnterWriteLock(); ZkUtils.CreateEphemeralPathExpectConflict(this.GetZkClient(), dirs.ConsumerRegistryDir + "/" + consumerIdString, topicCount.ToJsonString()); Logger.InfoFormat("successfully registering consumer {0} in ZK", consumerIdString); } catch (Exception ex) { Logger.ErrorFormat("error in RegisterConsumerInZk CreateEphemeralPathExpectConflict : {0}", ex.FormatException()); } finally { GetZkClient().SlimLock.ExitWriteLock(); } }