philipnee commented on code in PR #14680:
URL: https://github.com/apache/kafka/pull/14680#discussion_r1388405248
##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumer.java:
##########
@@ -381,21 +391,28 @@ public void commitAsync(OffsetCommitCallback callback) {
@Override
public void commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets,
OffsetCommitCallback callback) {
CompletableFuture<Void> future = commit(offsets, false);
- final OffsetCommitCallback commitCallback = callback == null ? new
DefaultOffsetCommitCallback() : callback;
future.whenComplete((r, t) -> {
- if (t != null) {
- commitCallback.onComplete(offsets, new KafkaException(t));
- } else {
- commitCallback.onComplete(offsets, null);
+ if (callback == null) {
+ if (t != null) {
+ log.error("Offset commit with offsets {} failed", offsets,
t);
+ }
+ return;
}
- }).exceptionally(e -> {
- throw new KafkaException(e);
+
+ invoker.submit(new OffsetCommitCallbackTask(callback, offsets,
(Exception) t));
});
}
// Visible for testing
CompletableFuture<Void> commit(Map<TopicPartition, OffsetAndMetadata>
offsets, final boolean isWakeupable) {
+ maybeThrowFencedInstanceException();
+ maybeInvokeCallbacks();
maybeThrowInvalidGroupIdException();
+
+ if (offsets.isEmpty()) {
+ return CompletableFuture.completedFuture(null);
+ }
Review Comment:
Thanks, I'll add a PR for investigation. I think metadata was not in the
implementation at the time the function was implemented.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]