private IDictionary <string, object> BuildConfig(KafkaConfigType configType, IEnumerable <KeyValuePair <string, object> > extendedConfig) { IDictionary <string, object> cfg = BuildConfig(configType); foreach (KeyValuePair <string, object> pair in extendedConfig) { cfg[pair.Key] = pair.Value; } return(cfg); }
private IDictionary <string, object> BuildConfig(KafkaConfigType configType) { const string producerPrefix = "producer/", consumerPrefix = "consumer/"; const StringComparison strComp = StringComparison.InvariantCultureIgnoreCase; var d = new Dictionary <string, object> { { "bootstrap.servers", Brokers } }; foreach (KeyValuePair <string, StringValues> pair in Parameters) { if (pair.Key.StartsWith("#")) { continue; } string k = pair.Key; switch (configType) { case KafkaConfigType.Producer: if (k.StartsWith(consumerPrefix, strComp)) { continue; } if (k.StartsWith(producerPrefix, strComp)) { k = k.Substring(producerPrefix.Length); } d.Add(k, pair.Value.ToString()); break; case KafkaConfigType.Consumer: if (k.StartsWith(producerPrefix, strComp)) { continue; } if (k.StartsWith(consumerPrefix, strComp)) { k = k.Substring(consumerPrefix.Length); } d.Add(k, pair.Value.ToString()); break; } } return(d); }