Stig Rohde Døssing created KAFKA-7616:
-----------------------------------------

             Summary: MockConsumer can return ConsumerRecords objects with a 
non-empty map but no records
                 Key: KAFKA-7616
                 URL: https://issues.apache.org/jira/browse/KAFKA-7616
             Project: Kafka
          Issue Type: Bug
          Components: clients
    Affects Versions: 2.0.1
            Reporter: Stig Rohde Døssing
            Assignee: Stig Rohde Døssing


The ConsumerRecords returned from MockConsumer.poll can return false for 
isEmpty while not containing any records. This behavior is because 
MockConsumer.poll eagerly adds entries to the returned Map<TopicPartition, 
List<ConsumerRecord>>, based on which partitions have been added. If no records 
are returned for a partition, e.g. because the position was too far ahead, the 
entry for that partition will still be there.

 

The MockConsumer should lazily add entries to the map as they are needed, since 
it is more in line with how the real consumer behaves.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to