Skip to content

Reader does not return any message when configured with reading inclusive latest messageId #10483

@tomjohn9

Description

@tomjohn9

Describe the bug
Creating reader with messageId pointing to MessageId.latest together with startMessageIdInclusive,there is no message returned when readNext is invoked. Newly coming messages are consumed. When using MessageId.earliest, a message is returned - means there are messages in that topic.

Having running local docker image with puslar 2.7.1 and java client 2.7.1

Steps To Reproduce

pulsarClient.newReader(JSONSchema.of(MySchema.class))
                .topic(topic)
                .startMessageId(MessageId.latest)
                .startMessageIdInclusive().create()
                .readNext(250, TimeUnit.MILLISECONDS)

Expected behavior
Last message in queue is returned when calling Reader.readNext with Reader configuration MessageId.latest and startMessageIdInclusive()

Similar Issue
Seems, it was already reported in issue 4912 in first paragraph Test3

Test3:When configuring Reader with startMessageIdInclusive and positioning stream at MessageId.latest, then the next call to Reader.readNext(timeout) should have returned the last message of the topic, but it times out and returns null (without a configured timeout it blocks forever).
.....
Expected behavior
test3 expected to return the last message in topic, test4 hasMessageAvailable expected to be false.

but it is little bit confusing because underlying method readMessage starts with hasMessageAvailable() which in that time returns wrongly true and readNext is reached but no message is returned, but should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions