Skip to content

Reader#hasMessageAvailable give wrong value after Reader#seek #7796

@aloyszhang

Description

@aloyszhang

Describe the bug
Reader#hasMessageAvailable is used for checking if there is any message available to read from the current position.
But in this case:

  1. Reader#seek a time after the publish time of the last message
  2. Reader#hasMessageAvailable still return true and Reader#readNext will be blocked
    It looks unseemly, Reader#hasMessageAvailable shoule gives false since there no more new messages to read.
    The reason it that Reader#hasMessageAvailable will finally call ConsumerImpl#getLastMessageIdAsync which just return the last messageId.
    Reader#seek has no effect on Reader#hasMessageAvailable.

Related issue [#7775 ]
To Reproduce

  1. Reader#seek a time after the publish time of the last message
  2. Reader#hasMessageAvailable still return true

Expected behavior
Reader#hasMessageAvailable shoule gives false if there no more new messages to read.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions