예제 #1
0
        public KafkaProducer(KafkaProducerOptions options)
        {
            _options = options;
            var conf = new ProducerConfig {
                BootstrapServers = _options.BootstrapServers
            };

            Action <DeliveryReport <Null, string> > handler = r =>
                                                              Console.WriteLine(!r.Error.IsError
                    ? $"Delivered message to {r.TopicPartitionOffset}"
                    : $"Delivery Error: {r.Error.Reason}");

            _producer = new ProducerBuilder <Null, string>(conf)
                        .Build();
        }
예제 #2
0
 public KafkaProducer CreateProducer(KafkaProducerOptions options)
 {
     return(new KafkaProducer(options));
 }