Hi all,
I am using Kafka admin client to query consumer group partition offsets
(committed and latest) using the below code:
Map<TopicPartition, OffsetAndMetadata> offsets =
admin.listConsumerGroupOffsets(CONSUMER_GROUP)
.partitionsToOffsetAndMetadata().get();
Map<TopicPartition, OffsetSpec> requestLatestOffsets = new HashMap<>();
for(TopicPartition tp: offsets.keySet()) {
requestLatestOffsets.put(tp, OffsetSpec.latest());
}
Map<TopicPartition, ListOffsetsResult.ListOffsetsResultInfo> latestOffsets =
admin.listOffsets(requestLatestOffsets).all().get();
During rebalance of the consumer group (e.g., say a consumer is joining the
group) does the admin API blocks until the rebalance completes? Or does it just
return whatever information on the consumer group members/offset is present at
the request time? I am sying some zero values for the offsets
(latest/committed), when I programmatically add a consumer and after few
seconds (3-4) query for the offsets.
Thank you.