示例#1
0
        public KafkaListener(
            IServiceScopeFactory serviceFactory,
            IOptions <KafkaProducerOptions> producerOptions,
            IOptions <KafkaConsumerOptions> consumerOptions)
        {
            _kafkaProducerOptions = producerOptions.Value;
            _kafkaConsumerOptions = consumerOptions.Value;
            _serviceFactory       = serviceFactory;

            _producerConfig = ConfigProducer();
            _consumerConfig = ConfigConsumer();

            _topics = _kafkaConsumerOptions.Topics.Split(",");
        }