Glade , it work for you .

Kafka Admin API run on zookeeper and sometime you don’t have access to 
Zookeeper host /port . I don’t know in your scenario how you are managing 
kafka/Zk cluster but for security purpose , Zookeeper access only limited to 
kafka Cluster .


From: SenthilKumar K <senthilec...@gmail.com>
Date: Tuesday, May 5, 2020 at 12:06 PM
To: "Agrawal, Manoj (Cognizant)" <manoj.agraw...@cognizant.com>, Senthil kumar 
<senthilec...@gmail.com>
Cc: "users@kafka.apache.org" <users@kafka.apache.org>, 
"senthilec...@apache.org" <senthilec...@apache.org>
Subject: Re: KafkaConsumer.partitionsFor() Vs KafkaAdminClient.describeTopics()

[External]
Thanks Manoj. It works for me.

Looks to me the KafkaAdminClient (Singleton instance ) is faster than 
Consumer.partitionsFor() API. In terms of performance which one is good to 
fetch the metadata of a given topic. Thanks!

On Wed, May 6, 2020 at 12:26 AM 
<manoj.agraw...@cognizant.com<mailto:manoj.agraw...@cognizant.com>> wrote:
I think you can filter list of topic return by  KafkaConsumer.partitionsFor()  
on by using method  type , if this is PartitionInfo.leader()   then include  
those partition  in list .



On 5/5/20, 11:44 AM, "SenthilKumar K" 
<senthilec...@gmail.com<mailto:senthilec...@gmail.com>> wrote:

    [External]


    Hi Team, We are using KafkaConsumer.partitionsFor() API to find the list of
    available partitions. After fetching the list of partitions, We use
    Consumer.offsetsForTimes() API to find the offsets for a given timestamp.

    The API Consumer.partitionsFor() simply returning all partitions including
    the partitions which the leader is set to -1. It's causing an issue
    (Timeout Exception) when we call Consumer.offsetsForTimes() API.

    I'm planning to use adminClient.describeTopics(list).all().get(); And
    filter only the partitions which are healthy. Will there be any performance
    impact of using AdminClient?

    Kafka Version: 2.4.1
    Kafka Client: 2.3.0

    --Senthil


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored. This e-mail and any files transmitted with it are for the sole 
use of the intended recipient(s) and may contain confidential and privileged 
information. If you are not the intended recipient(s), please reply to the 
sender and destroy all copies of the original message. Any unauthorized review, 
use, disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

Reply via email to