wolfstudy commented on issue #328:
URL:
https://github.com/apache/pulsar-client-go/issues/328#issuecomment-662793192
> use case: If I send message m1, m2 and m3 to a topic t1, when my system
restarts, I want to be able to read the last message sent to t1, in this case
m3.
Thanks @quintans work for this, The current behavior is in line with
expectations. When the consumer/reader restarts, the producer will continue to
send messages during this period of time. At this time, the last message
received by the reader is the message received from the topic after the reader
has started successfully.
For example:
We start the reader first, and then start the producer. The producer sends
four messages m0, m1, m2, and m3. At this time, the message received by the
reader should be m0, m1, m2, m3. When the reader restarts for some reason, the
producer sends the three messages m4, m5, and m6 during the restart period.
Then when the reader is restarted, these three messages will not be received.
But we can read the message by specifying a specific messageID.
```
reader, err := client.CreateReader(ReaderOptions{
Topic: topic,
StartMessageID: msgIDs[4],
})
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]