예제 #1
0
 public KafkaProducer(JsonSerializerSettingsProvider jsonSerializerSettingsProvider, KafkaTopicProvider kafkaTopicProvider, IOptions <GlobalSettings> globalSettings, ILogger <KafkaProducer> logger)
 {
     this.jsonSerializerSettingsProvider = jsonSerializerSettingsProvider;
     this.kafkaTopicProvider             = kafkaTopicProvider;
     this.globalSettings = globalSettings;
     this.logger         = logger;
 }
        public KafkaConsumer(ILogger <KafkaConsumer> logger, KafkaTopicProvider kafkaTopicProvider, EventDispatcher eventDispatcher, JsonSerializerSettingsProvider jsonSerializerSettingsProvider)
        {
            this.logger                         = logger;
            this.kafkaTopicProvider             = kafkaTopicProvider;
            this.eventDispatcher                = eventDispatcher;
            this.jsonSerializerSettingsProvider = jsonSerializerSettingsProvider;

            consumer = new Consumer <byte[], byte[]>(config, new ByteArrayDeserializer(), new ByteArrayDeserializer());
            consumer.OnPartitionsAssigned += OnPartitionsAssigned;
            consumer.OnPartitionsRevoked  += OnPartitionsRevoked;

            ResubscribeToTopics();
        }