private void SetZooKeeperConfiguration(ZooKeeperConfigurationElement config) { if (config.Servers.Count == 0) { throw new ConfigurationErrorsException(); } var sb = new StringBuilder(); foreach (ZooKeeperServerConfigurationElement server in config.Servers) { sb.Append(GetIpAddress(server.Host)); sb.Append(':'); sb.Append(server.Port); sb.Append(','); } sb.Remove(sb.Length - 1, 1); ZooKeeper = new ZooKeeperConfiguration( sb.ToString(), config.SessionTimeout, config.ConnectionTimeout, config.SyncTime); }
/// <summary> /// Convert Zookeeper string to ZookeeperConfiguration /// </summary> /// <param name="zookeeperAddress"></param> /// <returns></returns> public static ZooKeeperConfiguration ToZookeeperConfig(string zookeeperAddress) { ZooKeeperConfiguration zookeeperConfig = null; if (!string.IsNullOrEmpty(zookeeperAddress)) { zookeeperConfig = new ZooKeeperConfiguration(); zookeeperConfig.ZkConnect = zookeeperAddress; } return zookeeperConfig; }
public ProducerConfiguration(ZooKeeperConfiguration zooKeeperConfig) : this() { this.ZooKeeper = zooKeeperConfig; this.PartitionerClass = DefaultPartitioner; }
/// <summary> /// Initializes a new instance of the <see cref="ZooKeeperAwareKafkaClientBase"/> class. /// </summary> /// <param name="config">The config.</param> protected ZooKeeperAwareKafkaClientBase(ZooKeeperConfiguration config) { this.IsZooKeeperEnabled = config != null && !string.IsNullOrEmpty(config.ZkConnect); }
private void SetZooKeeperConfiguration(ZooKeeperConfigurationElement config) { if (config.Servers.Count == 0) { throw new ConfigurationErrorsException(); } var sb = new StringBuilder(); foreach (ZooKeeperServerConfigurationElement server in config.Servers) { sb.Append(GetIpAddress(server.Host)); sb.Append(':'); sb.Append(server.Port); sb.Append(','); } sb.Remove(sb.Length - 1, 1); this.ZooKeeper = new ZooKeeperConfiguration( sb.ToString(), config.SessionTimeout, config.ConnectionTimeout, config.SyncTime); }