[ https://issues.apache.org/jira/browse/KAFKA-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182823#comment-13182823 ]
Neha Narkhede commented on KAFKA-238: ------------------------------------- I see Jay's point about making this API general enough to avoid API upgrades later. It looks like this API can potentially be useful to the producer as well as the consumer, in addition to the admin commands. If we want to support producer and consumer, it means we can make this API return all metadata for all partitions on a topic. Also returning host/port for other replicas, and offset/timestamp for log segment might not add significant overhead. Given the benefit of generalization, it doesn't sound like a bad idea. > add a getTopicMetaData method in broker and expose it to producer > ------------------------------------------------------------------ > > Key: KAFKA-238 > URL: https://issues.apache.org/jira/browse/KAFKA-238 > Project: Kafka > Issue Type: Sub-task > Components: core > Reporter: Jun Rao > > We need a way to propagate the leader and the partition information to the > producer so that it can do load balancing and semantic partitioning. One way > to do that is to have the producer get the information from ZK directly. This > means that the producer needs to maintain a ZK session and has to subscribe > to watchers, which can be complicated. An alternative approach is to have the > following api on the broker. > TopicMetaData getTopicMetaData(String: topic) > TopicMetaData { > Array[PartitionMetaData]: partitionsMetaData > } > PartitionMetaData { > Int: partitionId > String: leaderHostname > Int: leaderPort > } > Using this api, the producer can get the metadata about a topic during > initial startup or leadership change of a partition. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira