Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param IMetadata $metadata
  * @param String $groupId
  */
 protected function __construct(IMetadata $metadata, $groupId)
 {
     $this->metadata = $metadata;
     $this->topicMetadata = $this->metadata->getTopicMetadata();
     $this->groupId = $groupId;
     $this->processId = gethostname() . "-" . uniqid();
     $this->metadata->registerConsumerProcess($this->groupId, $this->processId);
 }
Ejemplo n.º 2
0
 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();
 }