(PECL rdkafka >= 3.1.0, librdkafka >= 0.9)
RdKafka\KafkaConsumer::getCommittedOffsets — Returns the committed offsets
$topics
, int $timeout_ms
) : arrayReturns the committed offsets for topics and partitions for a consumer group
topics
(array)Array of RdKafka\TopicPartition.
timeout_ms
(int)Timeout in milliseconds.
Returns an array of RdKafka\TopicPartition with their offsets
Example #1 RdKafka\KafkaConsumer::getCommittedOffsets() example
<?php
$conf = new RdKafka\Conf();
$conf->set("group.id", "myGroupID");
$kafkaConsumer = new RdKafka\KafkaConsumer($conf);
$topicPartition = new TopicPartition('myTopic', 0);
$timeoutMs = 10000000;
$topicPartitionsWithOffsets = $kafkaConsumer->getCommittedOffsets([$topicPartition], $timeoutMs));
?>