[ 
https://issues.apache.org/jira/browse/KAFKA-7733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16720419#comment-16720419
 ] 

ASF GitHub Bot commented on KAFKA-7733:
---------------------------------------

srdo opened a new pull request #6030: KAFKA-7733: Reset the MockConsumer 
position according to its reset st…
URL: https://github.com/apache/kafka/pull/6030
 
 
   …rategy if the position is behind the beginning offset
   
   The poll method in MockConsumer will now use the configured reset strategy 
when it encounters a record with an offset below the beginning offset. 
   
   The poll method will also not clear the records list automatically. Letting 
the consumer position control which records are returned from poll is more 
similar to how the real consumer works, so e.g. a test can put a message in the 
consumer, poll for it, seek to the beginning and get the message out again. If 
tests need to delete the records entirely, they can still do so through a new 
method.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> MockConsumer doesn't respect reset strategy
> -------------------------------------------
>
>                 Key: KAFKA-7733
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7733
>             Project: Kafka
>          Issue Type: Improvement
>          Components: clients
>            Reporter: Stig Rohde Døssing
>            Assignee: Stig Rohde Døssing
>            Priority: Major
>
> The MockConsumer throws OffsetOutOfRangeException if a record is behind the 
> beginning offset. This is unlike the real consumer, which will use 
> auto.offset.reset to decide whether to seek to the beginning, end or throw an 
> exception.
> It is convenient if the poll method does the offset reset properly, since it 
> allows for testing cases like a consumer requesting offsets from a truncated 
> log.



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

Reply via email to