-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
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.