I am using the following code to read message from kafka . But to set consumer i have to give connection timeout . In my case i want a continuous reading consumer i cant set connection time out because some time it may not get any message from long time . How i handle it .
while (true) {
$message = $topic->consume(0, 1200); //120*10000);
if(isset($message->err)){
switch ($message->err) {
case RD_KAFKA_RESP_ERR_NO_ERROR:
break;
case RD_KAFKA_RESP_ERR__TIMED_OUT
break;
default:
break;
}
}