Ewen Cheslack-Postava <ewen@...> writes:
Im also searching the shortest way to find topic partition count, so that the
initialization code in the thread pool can set up the right number of threads.
so far i found below is the shortest way.
public static void main(String[] args){
int sessionTimeoutMs = 10000;
int connectionTimeoutMs = 10000;
ZkClient zkClient = new ZkClient("localhost:2181",
sessionTimeoutMs, connectionTimeoutMs);
TopicMetadata metaData =
AdminUtils.fetchTopicMetadataFromZk("forthtopic",zkClient);
System.out.println(metaData.partitionsMetadata().size());
}
kindly reply if you find any other shortest way.