weiboad / kafka-php

kafka php client
Apache License 2.0
1.44k stars 450 forks source link

(The consumers at 2.12, 1.0.0 can't read the data)2.12 1.0.0 的消费者无法读取数据 #158

Open momozi-coder opened 6 years ago

momozi-coder commented 6 years ago

The consumers at 2.12, 1.0.0 can't read the data, and the producer can send the data, and the whole process appears to be dead when the user is using it, and it never responds.

2.12 1.0.0 的消费者无法读取数据,生产者可以发送数据的,当使用消费者的时候整个进程出现卡死状态,一直没有反应。

nmred commented 6 years ago

@huyouheng can you provide more details on this? Like you test code, etc

momozi-coder commented 6 years ago

`require './vendor/autoload.php'; date_default_timezone_set('PRC'); use Monolog\Logger; use Monolog\Handler\StreamHandler;

$config = \Kafka\ConsumerConfig::getInstance(); $config->setMetadataRefreshIntervalMs(10000); $config->setMetadataBrokerList('127.0.0.1:9092'); $config->setGroupId('test'); $config->setBrokerVersion('1.0.0'); $config->setTopics(array('test')); //$config->setOffsetReset('earliest'); $consumer = new \Kafka\Consumer(); $consumer->setLogger($log); $consumer->start(function($topic, $part, $message) { var_dump($message); }); ` PHP 7.2.0 (cli) (built: Dec 13 2017 17:54:19) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies

consumers can't read the data 。

nmred commented 6 years ago

@huyouheng kafka-php version is v0.2.0.8?

momozi-coder commented 6 years ago

kafka version is kafka_2.12-1.0.0.tgz。kafka-php version is "nmred/kafka-php": "v0.2.0.8",

nmred commented 6 years ago

You can runing this example https://github.com/weiboad/kafka-php/blob/v0.2.0.8/example/protocol/MetaData.php get kafka cluster broker info, check broker host and port is it possible to connect?

momozi-coder commented 6 years ago

Thank you, I'll try。

jsantoso commented 6 years ago

Hi,

I am also having this problem. I use docker run the kafka service. Kafka is from wurstmeister/kafka:1.1.0 image and zookeeper is from zookeeper:3.4 image. kafka-php version is "dev-master".

I have tried the code in the MetaData.php example and I am able to connect. The producer actually works and I can confirm the produced messages via command-line consumer. It is just that the consumer never receives new messages.