Esempio n. 1
0
 private function setProducerTopic($mode = '')
 {
     if (!$this->producer_topic) {
         if (!isset($this->producer)) {
             echo "error : produce wrong identity";
             exit;
         }
         $rd_topic_conf = new RdKafka\TopicConf();
         $rd_topic_conf->set("request.required.acks", self::PRODUCER_REQUEST_ACK);
         if ($mode == 'consistent') {
             $rd_topic_conf->setPartitioner(RD_KAFKA_MSG_PARTITIONER_CONSISTENT);
         }
         //print_r($rd_topic_conf->dump());exit;
         $this->producer_topic = $this->producer->newTopic($this->topic_name, $rd_topic_conf);
     }
 }