Ejemplo n.º 1
0
        public KafkaListenerService(
            ILogger <KafkaListenerService> logger,
            HandlerInvoker handlerFactory,
            SubscriberConfig subscriberConfig)
        {
            if (!subscriberConfig.IsValid)
            {
                throw new ArgumentException(nameof(subscriberConfig));
            }

            this._logger         = logger;
            this._config         = subscriberConfig;
            this._handlerFactory = handlerFactory;

            if (subscriberConfig.Topics == null || !subscriberConfig.Topics.Any())
            {
                _logger.LogWarning("No topics found to subscribe");
            }
            else
            {
                _logger.LogInformation($"subscribing to {JsonConvert.SerializeObject(subscriberConfig.Topics)}");
            }
        }
Ejemplo n.º 2
0
 public KafkaListenerService(
     ILogger <KafkaListenerService> logger,
     HandlerInvoker handlerFactory,
     IOptions <SubscriberConfig> subscriberConfig) : this(logger, handlerFactory, subscriberConfig.Value)
 {
 }