kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Jain <ankitm.j...@impetus.co.in>
Subject Get replication and partition count of a topic
Date Mon, 12 Jan 2015 08:31:28 GMT
Hi All,

I want to get the replication and partition count of a topic. I tried the following piece
of code:

        java.util.Set<String> topics = new HashSet<String>();
        Set<TopicMetadata> topicMetadatas = AdminUtils.fetchTopicMetadataFromZk(JavaConversions.asScalaSet(topics),
        Iterator<TopicMetadata> topicMetadataIterator = topicMetadatas.iterator();

        while (topicMetadataIterator.hasNext()) {
            Iterator<PartitionMetadata> partitionMetadataIterator = topicMetadataIterator.next().partitionsMetadata().iterator();


But, the above code returning me the metadata of each partition and also replica details of
each partition.

Is there any simple API available in kafka to get the partition and replica count for a topic.




NOTE: This message may contain information that is confidential, proprietary, privileged or
otherwise protected by law. The message is intended solely for the named addressee. If received
in error, please destroy and notify the sender. Any use of this email is prohibited when received
in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this
communication has been maintained nor that the communication is free of errors, virus, interception
or interference.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message