You can use the lowlevel consumer for this, it has an API call 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 <hafizmujadid00@gmail.com> 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: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org