kirktrue commented on code in PR #16686:
URL: https://github.com/apache/kafka/pull/16686#discussion_r1838921182


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumer.java:
##########
@@ -1216,6 +1235,81 @@ public void close(Duration timeout) {
         }
     }
 
+    /**
+     * Please keep these tenets in mind for the implementation of the {@link 
AsyncKafkaConsumer}’s
+     * {@link #close(Duration)} method. In the future, these tenets may be 
made officially part of the top-level
+     * {@link KafkaConsumer#close(Duration)} API, but for now they remain here.
+     *
+     * <ol>
+     *     <li>
+     *         The execution of the {@link ConsumerRebalanceListener} callback 
(if applicable) must be performed on
+     *         the application thread to ensure it does not interfere with the 
network I/O on the background thread.
+     *     </li>
+     *     <li>
+     *         The {@link ConsumerRebalanceListener} callback execution must 
complete before an attempt to leave
+     *         the consumer group is performed. In this context, “complete” 
does not necessarily imply
+     *         <em>success</em>; execution is “complete” even if the execution 
<em>fails</em> with an error.
+     *     </li>
+     *     <li>
+     *         Any error thrown during the {@link ConsumerRebalanceListener} 
callback execution will be caught to
+     *         ensure it does not prevent execution of the remaining {@link 
#close()} logic.
+     *     </li>
+     *     <li>
+     *         The application thread will be blocked during the entire 
duration of the execution of the
+     *         {@link ConsumerRebalanceListener}. The {@link #close()} method 
does not employ a mechanism to
+     *         short-circuit the callback execution.
+     *     </li>
+     *     <li>
+     *         Since the {@link ConsumerRebalanceListener} APIs do not include 
a timeout parameter, a given
+     *         {@link ConsumerRebalanceListener} implementation cannot alter 
its behavior to adhere to the timeout.

Review Comment:
   I consolidated these points. LMK if it still needs work.



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