RdKafka\KafkaConsumer::getOffsetPositions

(PECL rdkafka >= 4.0.0, librdkafka >= 0.9.1)

RdKafka\KafkaConsumer::getOffsetPositionsRetrieve the current offsets for topics / partitions

Description

public RdKafka\KafkaConsumer::getOffsetPositions ( array $topics ) : array

The offset field of each requested partition will be set to the offset of the last consumed message + 1, or RD_KAFKA_OFFSET_INVALID in case there was no previous message.

Parameters

topics (array)

Array of RdKafka\TopicPartition.

Return Values

Returns an array of RdKafka\TopicPartition with their offsets

Examples

Example #1 RdKafka\KafkaConsumer::getOffsetPositions() 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->getOffsetPositions([$topicPartition]));
?>

Errors/Exceptions