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

14th
Jun 2018
karavzeka
@karavzeka
Jun 14 2018 10:33
I found decision. Perhaps it will help someone else. I changed High-level consumer to Low-level consumer and timeouts disappeared.
This is an example of code
protected function initChild(): void
{
    $this->childBornTime = time();

    $brokerList = [];
    foreach ($this->brokerAddresses as $index => $brokerAddress) {
        $brokerList[] = $brokerAddress['host'] . ':' . $brokerAddress['port'];
    }
    if (empty($brokerList)) {
        throw new \ErrorException('No one broker is assigned');
    }

    $topicConf = new TopicConf();
    $topicConf->set('auto.offset.reset', 'smallest');

    $conf = new Conf();
    $conf->set('client.id', __CLASS__ . ':' . $this->partitionNumber);
    $conf->set('group.id', 'group_' . $this->queueName);

    $kafkaConsumer = new Consumer($conf);
    $kafkaConsumer->addBrokers(implode(',', $brokerList));

    $this->queue = $kafkaConsumer->newQueue();

    $topic = $kafkaConsumer->newTopic($this->queueName, $topicConf);
    $topic->consumeQueueStart($this->partitionNumber, RD_KAFKA_OFFSET_STORED, $this->queue);
}