Hi, there is a way to know or get Consumer Group members/consumers/instances?
i know there is an option in Kafka itself ('GroupMembers') but i need it in node.
thanks
If you are referring to https://kafka.apache.org/protocol#The_Messages_ListGroups then this can be achieved using the following code...
const options = { kafkaHost: 'localhost:9092' };
const client = new kafka.KafkaClient(options);
const admin = new kafka.Admin(client);
// listen to the 'ready' event on the client first, then...
admin.listGroups((err, res) => {
let consumerGroups = Object.keys(res); // array of consumer group names
let count = consumerGroups.length; // count of consumer group entries
});
https://github.com/SOHU-Co/kafka-node#describegroupsconsumergroups-cb can then be used to get more info on a group(s).
Good answer, thanks
Most helpful comment
If you are referring to https://kafka.apache.org/protocol#The_Messages_ListGroups then this can be achieved using the following code...
https://github.com/SOHU-Co/kafka-node#describegroupsconsumergroups-cb can then be used to get more info on a group(s).