/** * Create * * @param String $connectionString * @param Float $apiVersion */ public static function Create($connectionString, $groupId, $apiVersion = 0.7) { $apiImplementation = Kafka::getApiImplementation($apiVersion); include_once "{$apiImplementation}/Metadata.php"; $metadataClass = "\\Kafka\\{$apiImplementation}\\Metadata"; $connector = new ConsumerConnector(new $metadataClass($connectionString), $groupId); return $connector; }
private function refreshMetadata() { if ($this->metadata == null) { $apiImplementation = Kafka::getApiImplementation($this->apiVersion); include_once "{$apiImplementation}/Metadata.php"; $metadataClass = "\\Kafka\\{$apiImplementation}\\Metadata"; $this->metadata = new $metadataClass($this->connectionString); } if ($this->producerList) { foreach ($this->producerList as $producer) { $producer->close(); } $this->producerList = array(); } $this->brokerMetadata = $this->metadata->getBrokerMetadata(); $this->topicMetadata = $this->metadata->getTopicMetadata(); }