AndrewJSchofield commented on code in PR #18336:
URL: https://github.com/apache/kafka/pull/18336#discussion_r1904383009


##########
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java:
##########
@@ -276,7 +279,10 @@
  * </pre>
  *
  * <b>Note: The committed offset should always be the offset of the next 
message that your application will read.</b>
- * Thus, when calling {@link #commitSync(Map) commitSync(offsets)} you should 
add one to the offset of the last message processed.
+ * Thus, when calling {@link #commitSync(Map) commitSync(offsets)} you should 
use {@code nextRecordToBeProcessed.offset()}
+ * or if {@link ConsumerRecords} is exhausted already {@link 
ConsumerRecords#nextOffsets()} instead.
+ * You should also pass in the {@link ConsumerRecord#leaderEpoch()} (or {@code 
nextOffsets().get(...).leaderEpoch()})

Review Comment:
   In the other similar places, you use the `You should also add the leader 
epoch as commit metadata, which can be obtained from {@link 
ConsumerRecord#leaderEpoch()} or {@link ConsumerRecords#nextOffsets()}.`. I 
think consistency would be good here.



-- 
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

Reply via email to