Example #1
0
 public SyncProducerConfig(ProducerConfigurationSection config, string host, int port)
 {
     this.Host                = host;
     this.Port                = port;
     this.SendBufferBytes     = config.SendBufferBytes;
     this.ClientId            = config.ClientId;
     this.RequestRequiredAcks = config.RequestRequiredAcks;
     this.RequestTimeoutMs    = config.RequestTimeoutMs;
 }
 public AsyncProducerConfig(ProducerConfigurationSection config, string host, int port)
     : base(config, host, port)
 {
     this.QueueBufferingMaxMs = config.QueueBufferingMaxMs;
     this.QueueBufferingMaxMessages = config.QueueBufferingMaxMessages;
     this.QueueEnqueueTimeoutMs = config.QueueEnqueueTimeoutMs;
     this.BatchNumMessages = config.BatchNumMessages;
     this.Serializer = config.Serializer;
     this.KeySerializer = config.KeySerializer;
 }
Example #3
0
 public AsyncProducerConfig(ProducerConfigurationSection config, string host, int port)
     : base(config, host, port)
 {
     this.QueueBufferingMaxMs       = config.QueueBufferingMaxMs;
     this.QueueBufferingMaxMessages = config.QueueBufferingMaxMessages;
     this.QueueEnqueueTimeoutMs     = config.QueueEnqueueTimeoutMs;
     this.BatchNumMessages          = config.BatchNumMessages;
     this.Serializer    = config.Serializer;
     this.KeySerializer = config.KeySerializer;
 }
Example #4
0
        public ProducerConfig(ProducerConfigurationSection config) : base(config, string.Empty, 0)
        {
            this.ProducerType = config.ProducerType;
            this.CompressionCodec = config.CompressionCodec;
            this.CompressedTopics = config.CompressedTopics;
            this.MessageSendMaxRetries = config.MessageSendMaxRetries;
            this.RetryBackoffMs = config.RetryBackoffMs;
            this.TopicMetadataRefreshIntervalMs = config.TopicMetadataRefreshIntervalMs;
            Validate(config);

            this.PartitionerClass = config.Partitioner;

            this.SetKafkaBrokers(config.Brokers);
        }
        public ProducerConfig(ProducerConfigurationSection config) : base(config, string.Empty, 0)
        {
            this.ProducerType                   = config.ProducerType;
            this.CompressionCodec               = config.CompressionCodec;
            this.CompressedTopics               = config.CompressedTopics;
            this.MessageSendMaxRetries          = config.MessageSendMaxRetries;
            this.RetryBackoffMs                 = config.RetryBackoffMs;
            this.TopicMetadataRefreshIntervalMs = config.TopicMetadataRefreshIntervalMs;
            Validate(config);

            this.PartitionerClass = config.Partitioner;

            this.SetKafkaBrokers(config.Brokers);
        }
        private static void Validate(ProducerConfigurationSection config)
        {
            if (config.Brokers.ElementInformation.IsPresent &&
                config.Brokers.Count == 0)
            {
                throw new ConfigurationErrorsException("Brokers list is empty");
            }

            if (config.Brokers.ElementInformation.IsPresent &&
                config.Partitioner != DefaultPartitioner)
            {
                throw new ConfigurationErrorsException("IPartitioner cannot be used when broker list is set");
            }

            ValidateClientId(config.ClientId);
            ValidateBatchSize(config.BatchNumMessages, config.QueueBufferingMaxMessages);
        }
Example #7
0
        private static void Validate(ProducerConfigurationSection config)
        {
            if (config.Brokers.ElementInformation.IsPresent
                && config.Brokers.Count == 0)
            {
                throw new ConfigurationErrorsException("Brokers list is empty");
            }

            if (config.Brokers.ElementInformation.IsPresent
                && config.Partitioner != DefaultPartitioner)
            {
                throw new ConfigurationErrorsException("IPartitioner cannot be used when broker list is set");
            }

            ValidateClientId(config.ClientId);
            ValidateBatchSize(config.BatchNumMessages, config.QueueBufferingMaxMessages);
        }
 public ProducerConfig(XElement xml) : this(ProducerConfigurationSection.FromXml(xml))
 {
 }