Beispiel #1
0
        public static SmartSqlDIBuilder AddKafkaSubscriber(this SmartSqlDIBuilder smartSqlDiBuilder,
                                                           Action <KafkaOptions> configure)
        {
            KafkaOptions kafkaOptions = new KafkaOptions();

            configure?.Invoke(kafkaOptions);
            smartSqlDiBuilder.Services.AddSingleton <ISubscriber, KafkaSubscriber>(sp =>
            {
                var loggerFactory = sp.GetRequiredService <ILoggerFactory>();
                return(new KafkaSubscriber(kafkaOptions, loggerFactory.CreateLogger <KafkaSubscriber>()));
            });
            return(smartSqlDiBuilder);
        }