These are chat archives for arnaud-lb/php-rdkafka

16th
Oct 2017
Keyur Shah
@keyurshah070
Oct 16 2017 06:56
can someone have some example on this ?
Magnus Edenhill
@edenhill
Oct 16 2017 07:21
consoumer->close()
Keyur Shah
@keyurshah070
Oct 16 2017 07:27
I downloaded rdkafka stub for editor and I can not find close() method
you can see my code below

`kafkaConsumer = new RdKafka\Consumer();
$kafkaConsumer->addBrokers("127.0.0.1:9292");
$topic = $kafkaConsumer->newTopic("test");
$topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);

while (true) {
$msg = $topic->consume(0, 1000);
if($msg){
if ($msg->err) {
echo $msg->errstr(), "\n";
break;
} else {
echo $msg->payload, "\n";
}
}
}`

Magnus Edenhill
@edenhill
Oct 16 2017 07:28
oh, right, they made it implicit in the destructor.
But that's the low-level consumer and you tell it to start at the beginning. If you want to continue where you last left off you should use the high-level consumer. See the docs for an example.
Keyur Shah
@keyurshah070
Oct 16 2017 07:29

$kafkaConsumer = new RdKafka\Consumer();
$kafkaConsumer->addBrokers("127.0.0.1:9292");
$topic = $kafkaConsumer->newTopic("test");
$topic->consumeStart(0, RD_KAFKA_OFFSET_BEGINNING);

while (true) {
$msg = $topic->consume(0, 1000);
if($msg){
if ($msg->err) {
echo $msg->errstr(), "\n";
break;
} else {
echo $msg->payload, "\n";
}
}
}`

Keyur Shah
@keyurshah070
Oct 16 2017 07:34
Thanks for the response
but I am not getting