I am using kafka-python and I am wondering if there is a way to show all topics.
Something like that:
./bin/kafka-topics.sh --list --zookeeper localhost:2181
import kafka consumer = kafka.KafkaConsumer(group_id='test', bootstrap_servers=['server']) consumer.topics()
Try the KafkaConsumer.topics () method .
Using confluent kafa and getting topics by group ID:
con = Consumer({'bootstrap.servers': 'host1:port,host2:port','group.id':'some-group-id'}) topic_meta = con.list_topics() topic_meta.topics.keys()