Manoj Nimmagadda
Manoj Nimmagadda

Reputation: 11

How to find leader/kafka broker of a partition when working with kafka 0.7.2 client

I am trying to write a SimpleConsumer for kafka and using kafka client 0.7.2 for doing the same. I am following the example given in the kafka 0.8 documentation: https://cwiki.apache.org/confluence/display/KAFKA/0.8.0+SimpleConsumer+Example

The example uses

private String findNewLeader(String a_oldLeader, String a_topic, int a_partition, int a_port) throws Exception

... to find a leader for a particular partition in the seed broker list provided. How do we do the same in kafka 0.7.2? Some of the code in the example doesn't apply to 0.7.2.

Are there any specific examples of how to figure out a leader for a partition when working with kafka 0.7.2 client?

Upvotes: 1

Views: 2260

Answers (1)

user2720864
user2720864

Reputation: 8161

As my understanding goes in 0.7.2 you don't need to find the leader broker for a topic/partition. Instead, you need to connect to each broker and request messages for a specific partition from all of them.

Upvotes: 1

Related Questions