From 96944c44be8349acd5f7e0d5d6f720136c92f32f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Oct 2020 19:36:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kafka/Kafka.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Kafka/Kafka.php b/Kafka/Kafka.php index 34890cc4..f0f6f49e 100644 --- a/Kafka/Kafka.php +++ b/Kafka/Kafka.php @@ -56,11 +56,10 @@ class Kafka extends \Snowflake\Process\Process { $this->channelListener(); [$config, $topic, $conf] = $this->kafkaConfig(); - $objRdKafka = new \RdKafka\Consumer($config); - $topic = $objRdKafka->newTopic('test', $topic); - $topic->consumeStart(0, RD_KAFKA_OFFSET_STORED); + $objRdKafka = new KafkaConsumer($config); + $objRdKafka->subscribe(['test']); while (true) { - $message = $topic->consume(0, $conf['metadataRefreshIntervalMs'] ?? 1000); + $message = $objRdKafka->consume($conf['metadataRefreshIntervalMs'] ?? 1000); if (empty($message)) { continue; }