frankvicky commented on code in PR #20511:
URL: https://github.com/apache/kafka/pull/20511#discussion_r2339120707


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -278,44 +269,28 @@ private void 
processStreamsOnAllTasksLostCallbackNeededEvent(final StreamsOnAllT
 
         private StreamsOnTasksRevokedCallbackCompletedEvent 
invokeOnTasksRevokedCallback(final Set<StreamsRebalanceData.TaskId> 
activeTasksToRevoke,
                                                                                
          final CompletableFuture<Void> future) {
-            final Optional<Exception> exceptionFromCallback = 
streamsRebalanceListener().onTasksRevoked(activeTasksToRevoke);
+            final Optional<Exception> exceptionFromCallback = 
Optional.ofNullable(streamsRebalanceListenerInvoker().invokeTasksRevoked(activeTasksToRevoke));
             final Optional<KafkaException> error = exceptionFromCallback.map(e 
-> ConsumerUtils.maybeWrapAsKafkaException(e, "Task revocation callback throws 
an error"));

Review Comment:
   +1
   It's reasonable to encapsulate these logics into the constructor, and it is 
also much easier to trace the whole flow of event construction. (We don't need 
to look at this helper method to understand the error shaping, etc)



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

Reply via email to