You can use the lowlevel consumer
<http://github.com/dibbhatt/kafka-spark-consumer> for this, it has an API
call
<https://github.com/dibbhatt/kafka-spark-consumer/blob/master/src/main/java/consumer/kafka/DynamicBrokersReader.java#L81>
to retrieve the number of partitions from a topic.

Easiest way would be to count the depth in:

yourZkPath + "/topics/" + topicName + "/partitions"


Thanks
Best Regards

On Sat, Jan 3, 2015 at 1:54 PM, Hafiz Mujadid <[email protected]>
wrote:

> Hi experts!
>
> I am currently working on spark streaming with kafka. I have couple of
> questions related to this task.
>
> 1) Is there a way to find number of partitions given a topic name?
> 2)Is there a way to detect whether kafka server is running or not ?
>
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://apache-spark-user-list.1001560.n3.nabble.com/getting-number-of-partition-per-topic-in-kafka-tp20952.html
> Sent from the Apache Spark User List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to