philipnee commented on code in PR #14680:
URL: https://github.com/apache/kafka/pull/14680#discussion_r1388409913


##########
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:
   Here is the Jira: https://issues.apache.org/jira/browse/KAFKA-15803



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