code: public static Map<String, List<String>> getConsumersPerTopic(ZkClient zkClient, String group) {
          ZkGroupDirs dirs = new ZkGroupDirs(group);
          List<String> consumers = getChildrenParentMayNotExist(zkClient, dirs.consumerRegistryDir);
          //
          Map<String, List<String>> consumersPerTopicMap = new HashMap<String, List<String>>();
          for (String consumer : consumers) {
              TopicCount topicCount = getTopicCount(zkClient, group, consumer);
              for (Map.Entry<String, Set<String>> e : topicCount.getConsumerThreadIdsPerTopic().entrySet()) {
                  final String topic = e.getKey();
                  for (String consumerThreadId : e.getValue()) {
                      List<String> list = consumersPerTopicMap.get(topic);
                      if (list == null) {
                          list = new ArrayList<String>();
                          consumersPerTopicMap.put(topic, list);
                      }
                      //
                      list.add(consumerThreadId);
                  }
              }
          }
          //
          for (Map.Entry<String, List<String>> e : consumersPerTopicMap.entrySet()) {
              Collections.sort(e.getValue());
          }
          return consumersPerTopicMap;
      }
docs: get all consumers for the group
  
  @param zkClient the zookeeper client
  @param group    the group name
  @return topic-&gt;(consumerIdStringA-0,consumerIdStringA-1...consumerIdStringB-0,consumerIdStringB-1)