How producer and consumer identify the leader in Kafka.
@Nilesh within the zookeeper the leader is given at this path:
at this path a value named 'partitions' is available, providing key value pairs of
<<partition id>> : <<broker id (of leader)>>
To identify the connection parameter for the broker id, check at the path
the attributes "host", "port" and "endpoints", where endpoints is a multivalue and can contain more than one endpoint.
Since Kafka version 0.9, Producers and consumers fetch all metadata details from Kafka brokers directly and Kafka brokers are in sync with Zookeeper. Each Kafka brokers have information about leader.