This commit is contained in:
2020-10-27 19:36:26 +08:00
parent 3fd4f642a7
commit 96944c44be
+3 -4
View File
@@ -56,11 +56,10 @@ class Kafka extends \Snowflake\Process\Process
{ {
$this->channelListener(); $this->channelListener();
[$config, $topic, $conf] = $this->kafkaConfig(); [$config, $topic, $conf] = $this->kafkaConfig();
$objRdKafka = new \RdKafka\Consumer($config); $objRdKafka = new KafkaConsumer($config);
$topic = $objRdKafka->newTopic('test', $topic); $objRdKafka->subscribe(['test']);
$topic->consumeStart(0, RD_KAFKA_OFFSET_STORED);
while (true) { while (true) {
$message = $topic->consume(0, $conf['metadataRefreshIntervalMs'] ?? 1000); $message = $objRdKafka->consume($conf['metadataRefreshIntervalMs'] ?? 1000);
if (empty($message)) { if (empty($message)) {
continue; continue;
} }