chia7712 commented on a change in pull request #10022:
URL: https://github.com/apache/kafka/pull/10022#discussion_r569105085



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java
##########
@@ -1236,7 +1236,7 @@ public void assign(Collection<TopicPartition> partitions) 
{
                 }
 
                 final FetchedRecords<K, V> records = pollForFetches(timer);
-                if (!records.isEmpty()) {
+                if (!records.records().isEmpty()) {

Review comment:
       not sure whether this is a kind of behavior change. The docs of 
```KafkaConsumer#poll``` indicates that ```timeout``` is used to wait available 
records.
   
   ```
        * This method returns immediately if there are records available. 
Otherwise, it will await the passed timeout.
        * If the timeout expires, an empty record set will be returned. Note 
that this method may block beyond the
        * timeout in order to execute custom {@link ConsumerRebalanceListener} 
callbacks.
   ```
   
   Maybe we can introduce a new API ```poll(Duration, Options)``` (similar to 
KafkaAdmin. The options enables us to adjust the poll behavior for specific use 
cases. Also, it opens a room to give various ```poll``` in the future.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to