0
votes

I've been following the high level consumer example - but it seems these for are consuming from kafka. I want to connect to zookeeper (zookeperhost:2181) and get a list of kafka brokers associated. Is there a way to do this with HLC?

Also, is there a way to use SimpleConsumer to find a list of kafka brokers, given zk?

1

1 Answers

0
votes

As you can see in the link you gave, you don't pass a broker list to the HLC, but

props.put("zookeeper.connect", a_zookeeper);

So it's already linked to zookeeper, and from there it will discover kafka brokers.

For you second question, you have the option of using ZkClient to get /brokers data in ZooKeeper, but I wouldn't do it since it depends on Kafka implementation details, which may or may not be stable.