示例#1
0
 public KafkaMessageBus(IServiceProvider serviceProvider, ILogger <KafkaMessageBus> logger, KafkaMessageBusOptions kafkaOptions)
 {
     _serviceProvider = serviceProvider;
     _logger          = logger;
     _kafkaOptions    = kafkaOptions;
     this._producer   = new KafkaProducer <string, KafkaMessageBusData>(this._serviceProvider);
 }
        public static IServiceCollection AddKafkaMessageBus(this IServiceCollection services, KafkaMessageBusOptions options)
        {
            services
            .AddSingleton <KafkaMessageBusOptions>(options)
            .AddSingleton <IKafkaMessageBus, KafkaMessageBus>();

            return(services);
        }