frankvicky commented on code in PR #18737: URL: https://github.com/apache/kafka/pull/18737#discussion_r1946841007
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ApplicationEventProcessor.java: ########## @@ -414,7 +415,15 @@ private void process(final ResetOffsetEvent event) { */ private void process(final CheckAndUpdatePositionsEvent event) { CompletableFuture<Boolean> future = requestManagers.offsetsRequestManager.updateFetchPositions(event.deadlineMs()); - future.whenComplete(complete(event.future())); + future.whenComplete((value, exception) -> { + if (exception != null) + event.future().completeExceptionally(exception); + else { + requestManagers.commitRequestManager.ifPresent(commitRequestManager -> + commitRequestManager.setLatestPartitionOffsets(subscriptions.allConsumed())); Review Comment: Hey @lianetm I'm not sure about implementing this one, so I wrote the rough code snippet. Please correct me if I'm wrong: ```java private void process(final AsyncCommitEvent event) { if (requestManagers.commitRequestManager.isEmpty()) { event.future().completeExceptionally(new KafkaException("Unable to async commit " + "offset because the CommitRequestManager is not available. Check if group.id was set correctly")); return; } try { CommitRequestManager manager = requestManagers.commitRequestManager.get(); if (event.offsets().isEmpty()) { Map<TopicPartition, OffsetAndMetadata> allConsumed = subscriptions.allConsumed(); event.future().complete(allConsumed); manager.commitAsync(Optional.of(allConsumed)); } else { CompletableFuture<Map<TopicPartition, OffsetAndMetadata>> future = manager.commitAsync(event.offsets()); future.whenComplete(complete(event.future())); } } catch (Exception e) { event.future().completeExceptionally(e); } } ``` -- 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