weiboad / kafka-php

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

Consumer not reading messages after restart #296

Open parveenbadoni opened 4 years ago

parveenbadoni commented 4 years ago

Following is my Consumer and Producer Script : Consumer Script $config = ConsumerConfig::getInstance(); $config->setMetadataRefreshIntervalMs(10000); $config->setMetadataBrokerList('localhost:9092'); $config->setGroupId('test'); $config->setBrokerVersion('1.1.1'); $config->setTopics(['Request']); $config->setOffsetReset('earliest'); $consumer = new Consumer(); $consumer->setLogger($logger); $consumer->start(function($topic, $part, $message) { var_dump($message); });

Producer Script $config = ProducerConfig::getInstance(); $config->setMetadataRefreshIntervalMs(10000); $config->setMetadataBrokerList('localhost:9092'); $config->setBrokerVersion('1.1.1'); $config->setRequiredAck(1); $config->setIsAsyn(false); $config->setProduceInterval(500); $producer = new \Kafka\Producer( function() { return [ [ 'topic' => 'Request', 'value' => 'My Test Data', ], ]; } ); $producer->success(function($result) { var_dump($result); }); $producer->error(function($errorCode) { var_dump($errorCode); }); $producer->send(true);

It is working fine. When consumer is running and producer is publishing data, consumer is able to read it. But once i stop consumer and then publish data and then start consumer, Consumer does not read that data. What am i doing wrong? Can someone help?

parveenbadoni commented 4 years ago

@lcobucci Can you please help?

lcobucci commented 4 years ago

@parveenbadoni sorry I can't :disappointed: this lib has some connection management issues that aren't that trivial to fix without big changes (IMHO). I've decided to focus on other projects then.

parveenbadoni commented 4 years ago

@parveenbadoni sorry I can't 😞 this lib has some connection management issues that aren't that trivial to fix without big changes (IMHO). I've decided to focus on other projects then.

Its ok @lcobucci :) Can you please recommend someone else who might help me in this issue

parveenbadoni commented 4 years ago

Hi @nmred, Can you please guide me where i am going wrong.