SOHU-Co / kafka-node

Node.js client for Apache Kafka 0.8 and later.
MIT License
2.66k stars 630 forks source link

Using multiple partitions in Consumer #1356

Open clivedsouza1010 opened 4 years ago

clivedsouza1010 commented 4 years ago

Bug Report

Hi,

I have a topic with multiple partitions. I am trying to create a Consumer but not able to specify all partitions while creating it, for,eg,

const consumer = new Consumer(kafkaClient, [{ topic: consumeTopic }], { groupId: 'kafka-node-group', autoCommit: false });

the above code just reads from partition 0. I tried something like,

const consumer = new Consumer(kafkaClient, [{ topic: consumeTopic, partition: '*' }], { groupId: 'kafka-node-group', autoCommit: false }); but, it did not work.

Can someone help me out. Thanks

Environment

For specific cases also provide

Include Sample Code to reproduce behavior

// include code here

Include output with Debug turned on

Thanks for your contribution!

0807Jpatel commented 4 years ago

Using ConsumerGroup lets you fetch data from all the partitions.