Finding the Topic and Partition Leader data for a cluster
Finding all the Topics, Partitions, Partition Leaders and Replicas for a cluster requires using a TopicMetaDataRequest in the SimpleConsumer.
The following code will connect to a Broker and print out all the Topics, Partitions, which Broker is a the leader and which Brokers are replicas for the Partitions.
By passing an empty List<String> to the TopicMetadatRequest you are asking Kafka to return data on all Topics.
To find the details for a specific Topic, add the name to the List<String> passed to the TopicMetadataRequest: