示例#1
0
 public KafkaClient(
     IOptions <ProducerConfig> producerConfig,
     IOptions <ConsumerConfig> consumerConfig,
     IOptions <RayKafkaOptions> options,
     ISerializer serializer)
 {
     producerObjectPool  = new DefaultObjectPool <PooledProducer>(new ProducerPooledObjectPolicy(producerConfig.Value), options.Value.ProducerMaxPoolSize);
     this.consumerConfig = consumerConfig.Value;
     this.serializer     = serializer;
     rayKafkaOptions     = options.Value;
 }
示例#2
0
 public KafkaClient(
     IOptions <ProducerConfig> producerConfig,
     IOptions <ConsumerConfig> consumerConfig,
     IOptions <RayKafkaOptions> options,
     ILogger <KafkaClient> logger,
     ISerializer serializer)
 {
     producerObjectPool  = new DefaultObjectPool <PooledProducer>(new ProducerPooledObjectPolicy(producerConfig.Value, logger), options.Value.ProducerMaxPoolSize);
     this.consumerConfig = consumerConfig.Value;
     this.consumerConfig.EnableAutoCommit   = false;
     this.consumerConfig.AutoOffsetReset    = AutoOffsetReset.Earliest;
     this.consumerConfig.EnablePartitionEof = true;
     this.serializer = serializer;
     rayKafkaOptions = options.Value;
     this.logger     = logger;
 }