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


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumer.java:
##########
@@ -226,11 +246,20 @@ public void commitAsync(OffsetCommitCallback callback) {
 
     @Override
     public void commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, 
OffsetCommitCallback callback) {
-        final CommitApplicationEvent commitEvent = new 
CommitApplicationEvent(offsets);
-        commitEvent.future().whenComplete((r, t) -> {
-            callback.onComplete(offsets, new RuntimeException(t));
+        CompletableFuture<Void> future = commit(offsets);
+        future.whenComplete((r, t) -> {
+            if (t != null) {
+                callback.onComplete(offsets, new RuntimeException(t));
+            } else {
+                callback.onComplete(offsets, null);
+            }
         });
+    }
+
+    private CompletableFuture<Void> commit(Map<TopicPartition, 
OffsetAndMetadata> offsets) {

Review Comment:
   I have a KIP proposal here: 
   1. Can we introduce a commit interface to return a CompletableFuture?
   2. Do we want to introduce a poll interface returning a CompletableFuture? 
(Like do we really need it to block?)



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