Kafka %5|1528340684.113|FAIL|rdkafka#consumer-1 Connection closed #176
- PHP version: PHP 7.2.5
- librdkafka version: 0.11.4-30-gfa1677
- php-rdkfaka version:3.0.5
$rk = new RdKafka\Consumer();
//$rk = new RdKafka\KafkaConsumer();
$rk->setLogLevel(LOG_DEBUG);
// 指定 broker 地址,多个地址用"," 分割
//$rk->addBrokers("172.16.1.139:9092,172.16.1.140:9092");
$rk->addBrokers("172.16.1.139,172.16.1.140");
$topic = $rk->newTopic("yantao_test_topic");
$topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);
while (true) {
// 第一个参数是分区号
// 第二个参数是超时时间
$msg = $topic->consume(0, 1000);
dd($msg);
if ($msg->err) {
echo $msg->errstr(), "\n";
break;
} else {
echo $msg->payload, "\n";
}
}
The result:
5|1528341132.428|FAIL|rdkafka#consumer-1| [thrd:172.16.1.140:9092/bootstrap]: 172.16.1.140:9092/bootstrap: Connection closed
%3|1528341132.429|ERROR|rdkafka#consumer-1| [thrd:172.16.1.140:9092/bootstrap]: 172.16.1.140:9092/bootstrap: Connection closed
%5|1528341132.429|FAIL|rdkafka#consumer-1| [thrd:172.16.1.139:9092/bootstrap]: 172.16.1.139:9092/bootstrap: Connection closed
%3|1528341132.429|ERROR|rdkafka#consumer-1| [thrd:172.16.1.139:9092/bootstrap]: 172.16.1.139:9092/bootstrap: Connection closed
猜你喜欢: