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:
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