You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Weide Zhang <we...@gmail.com> on 2014/08/01 17:46:55 UTC

find topic partition count through simpleclient api

Hi,

What's the way to find a topic's partition count dynamically using
simpleconsumer api ?

If I use one seed broker within a cluster of 10 brokers, and add list of
topic name into the simple consumer request to find topics' metadata, when
it returns,
is the size of partitionsMetadata per topicmetadata same as the number of
partitions for a given topic ? Also, for retrieval, do I need to have more
than 1 seed broker to get all metadata info of a topic? Is only 1 seed
broker enough ?

Thanks,

Weide

Re: find topic partition count through simpleclient api

Posted by Guozhang Wang <wa...@gmail.com>.
One seed broker should be enough, and the the number of partitionMetadata
should be the same as num. of partitions. One note here is that the
metadata is propagated asynchronously to the brokers, and hence the
metadata returned by any broker may be stale by small chances, so you need
to periodically pull the metadata.

Guozhang


On Fri, Aug 1, 2014 at 8:46 AM, Weide Zhang <we...@gmail.com> wrote:

> Hi,
>
> What's the way to find a topic's partition count dynamically using
> simpleconsumer api ?
>
> If I use one seed broker within a cluster of 10 brokers, and add list of
> topic name into the simple consumer request to find topics' metadata, when
> it returns,
> is the size of partitionsMetadata per topicmetadata same as the number of
> partitions for a given topic ? Also, for retrieval, do I need to have more
> than 1 seed broker to get all metadata info of a topic? Is only 1 seed
> broker enough ?
>
> Thanks,
>
> Weide
>



-- 
-- Guozhang