Example #1
0
        internal KafkaRawMessagePublisher(
            Func <IKafkaProducer> producerFunc,
            KafkaOptions options)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));
            var producer = producerFunc();

            try
            {
                _options.Publisher.ProducerCreatedCallback?.Invoke(producer.KafkaProducer);
            }
            catch
            {
                producer.Dispose();
                throw;
            }
            _producer = producer;
        }