what am i doing wrong?

88 views
Skip to first unread message

amir_wbpls

unread,
Dec 6, 2017, 11:44:09 AM12/6/17
to php-rdkafka
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,

Amir




Reply all
Reply to author
Forward
0 new messages