You might want ZkUtils.getPartitionsForTopic. But beware that it's an
internal method that could potentially change or disappear in the future.

If you're just looking for protocol-level solutions, the metadata API has a
request that will return info about the number of partitions:
https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol#AGuideToTheKafkaProtocol-MetadataAPI

On Thu, Feb 26, 2015 at 10:10 PM, Alex Melville <amelvi...@g.hmc.edu> wrote:

> I am writing a custom producer that needs to know information about the
> topic it's about to produce to. In particular it needs to know the number
> of partitions on the topic. Is there some utility method that returns such
> data? I am using scala v2.9.2 and kafka v8.2.0.
>
>
> Alex
>



-- 
Thanks,
Ewen

Reply via email to