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

7th
Dec 2017
amir-wbpls
@amir-wbpls
Dec 07 2017 12:38

Hello,

i installed rdkafka and paisted the code as defined in https://arnaud-lb.github.io/php-rdkafka/phpdoc/rdkafka.examples-producer.html

<?php
$rk = new RdKafka\Producer();
$rk->setLogLevel(LOG_DEBUG);
$rk->addBrokers("127.0.0.1:9092");

$topic = $rk->newTopic("test");

for ($i = 0; $i < 10; $i++) {
$topic->produce(RD_KAFKA_PARTITION_UA, 0, "Message $i");
$rk->poll(0);
}

while ($rk->getOutQLen() > 0) {
$rk->poll(50);
}

when i run this i get an infinite loop.seems that the problem line is
$topic->produce(RD_KAFKA_PARTITION_UA, 0, "Message $i");

when i place
var_dump($rk);

just before the $topic i get:

object(RdKafka\Producer)#1 (2) { ["error_cb":"RdKafka":private]=> NULL ["dr_cb":"RdKafka":private]=> NULL }

what does this mean and do i resolve this?

thanks,