mjsax commented on code in PR #18336: URL: https://github.com/apache/kafka/pull/18336#discussion_r1901289940
########## clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java: ########## @@ -266,8 +270,7 @@ * for (ConsumerRecord<String, String> record : partitionRecords) { * System.out.println(record.offset() + ": " + record.value()); * } - * long lastOffset = partitionRecords.get(partitionRecords.size() - 1).offset(); - * consumer.commitSync(Collections.singletonMap(partition, new OffsetAndMetadata(lastOffset + 1))); + * consumer.commitSync(Collections.singletonMap(partition, partitionRecords.nextOffsets().get(partition)); Review Comment: `partitionRecords` is actually correct; `nextRecords` was added to `ConsumerRecord[s]` (not `ConsumerRecord`) -- that's also why we need to call `get(partition)` -- `ConsumerRecords` is already data fro a single partition. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org