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(); }