public DefaultKafkaProducerPool( IOptions <KafkaOptions> kafkaOptions, IOptions <KafkaProducerOptions> options) { _options = options.Value; _options.BrokerServers = _options.BrokerServers == null || _options.BrokerServers.Length <= 0 ? kafkaOptions.Value.BrokerServers : _options.BrokerServers; _connectionPoolSize = _options.ConnectionPoolSize; _producerPool = new ConcurrentQueue <IProducer <string, byte[]> >(); }
public KafkaUnderlyingConfigBuilder Append(KafkaProducerOptions options) { if (options.BrokerServers == null || options.BrokerServers.Length <= 0) { throw new ArgumentNullException(nameof(options.BrokerServers)); } Append("bootstrap.servers", options.BrokerServers.Aggregate((x, y) => $"{x},{y}")); Append("request.required.acks", options.AcknowledgeOptions.Type); Append("request.timeout.ms", options.AcknowledgeOptions.TimeoutMilliseconds); Append("message.send.max.retries", options.AcknowledgeOptions.MaxRetries); Append("enable.idempotence", options.IdempotentOptions.Enable); return(this); }