Input to my python script is the name of a consumer group and the output is supposed to be the list of topics under the consumer group.
My code currently, doesn't return the topics for which the current offset is -1.
Is there a better way, by which I can obtain the list of all topics under the consumer group using Kafka-python.
I am actually looking to replace describe a topic in a group cmd using Kafka tools.
from kafka import KafkaAdminClient
topics_in_groups = {};
client = KafkaAdminClient(bootstrap_server='localhost:9092')
for group in client.list_consumer_groups():
topics_in_groups[group[0]] = [];
topic_dict = client.list_consumer_group_offsets(group[0]);
for topic in topic_dict:
topics_in_groups[group[0]].append(topic.topic)