You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It seems to me that when a message is posted to a topic via a transaction, two entries are inserted into the topic (as seen with pulsar manager ui, there is probably a system message and the actual posted message) as opposed to only one entry when the message is posted without a transaction.
When I use a reader to read all the messages in the same topic, I use the 'hasMessageAvailable' method and then read the message if there is one. The problem is, after reading the last message in the topic, the 'hasMessageAvailable' method still returns 'true' instead of 'false'.
Logically my reader tries to read the next message but gets stuck.
I think that the 'hasMessageAvailable' method returns 'true' because the broker API sees that my reader's cursor is not at the end of the topic (there is still a system message after the current position of my cursor) and does not differentiate between real and system messages. However, when the reader tries to read the last message it gets stuck because the broker API has no real message to return. This is just a guess.
Ps: I tried to use the 'hasReachedEndOfTopic' method, but it is of no use to me because it returns false all the time.
To Reproduce
Run pulsar standalone (with transactionCoordinatorEnabled=true in conf)
Note that the program never exits and that the last print is logically not done.
Expected behavior
The hasMessageAvailable method should return 'false' when the reader has finished reading all the messages in a topic that were all originally published via a separate transaction.
Desktop
OS: macOs v11.2.3
Java: v8
Pulsar (broker and client): v2.8.0
The text was updated successfully, but these errors were encountered:
@315157973@sijie@codelipenghui@lhotari@wolfstudy, I'm sorry to tag you but I just want to know if I'm doing something wrong with the transactions or with the reader or if this problem is already known. In this pr I saw that the problem had been fixed but not in the context of messages published via a transaction.
Describe the bug
It seems to me that when a message is posted to a topic via a transaction, two entries are inserted into the topic (as seen with pulsar manager ui, there is probably a system message and the actual posted message) as opposed to only one entry when the message is posted without a transaction.
When I use a reader to read all the messages in the same topic, I use the 'hasMessageAvailable' method and then read the message if there is one. The problem is, after reading the last message in the topic, the 'hasMessageAvailable' method still returns 'true' instead of 'false'.
Logically my reader tries to read the next message but gets stuck.
I think that the 'hasMessageAvailable' method returns 'true' because the broker API sees that my reader's cursor is not at the end of the topic (there is still a system message after the current position of my cursor) and does not differentiate between real and system messages. However, when the reader tries to read the last message it gets stuck because the broker API has no real message to return. This is just a guess.
Ps: I tried to use the 'hasReachedEndOfTopic' method, but it is of no use to me because it returns false all the time.
To Reproduce
Expected behavior
The hasMessageAvailable method should return 'false' when the reader has finished reading all the messages in a topic that were all originally published via a separate transaction.
Desktop
The text was updated successfully, but these errors were encountered: