public function getConsumersPerTopic($groupId)
{
$consumers = $this->listConsumer($groupId);
if (empty($consumers)) {
return array();
}
$topics = array();
foreach ($consumers as $consumerId) {
$path = sprintf(self::REG_CONSUMER, (string) $groupId) . '/' . $consumerId;
if (!$this->zookeeper->exists($path)) {
continue;
}
$info = $this->zookeeper->get($path);
$info = json_decode($info, true);
$subTopic = isset($info['subscription']) ? $info['subscription'] : array();
foreach ($subTopic as $topic => $num) {
$topics[$topic] = $consumerId;
}
}
return $topics;
}