예제 #1
0
        public static async Task <IGroupConsumer> CreateGroupConsumerAsync(this KafkaOptions options, string groupId, ConsumerProtocolMetadata metadata, CancellationToken cancellationToken)
        {
            var router = await options.CreateRouterAsync();

            var response = await router.JoinGroupAsync(groupId, ConsumerEncoder.Protocol, new [] { metadata }, options.ConsumerConfiguration, cancellationToken);

            return(new GroupConsumer(router, groupId, ConsumerEncoder.Protocol, response, options.ConsumerConfiguration, options.Encoders, false));
        }
예제 #2
0
 public static async Task <IProducer> CreateProducerAsync(this KafkaOptions options)
 {
     return(new Producer(await options.CreateRouterAsync(), options.ProducerConfiguration, false));
 }
예제 #3
0
 public static async Task <IConsumer> CreateConsumerAsync(this KafkaOptions options, string topicName, int partitionId)
 {
     return(new Consumer(topicName, partitionId, await options.CreateRouterAsync(), options.ConsumerConfiguration, false));
 }