wolfstudy commented on issue #328:
URL:
https://github.com/apache/pulsar-client-go/issues/328#issuecomment-662981076
Maybe `HasNext() ` is a good way.
```
func (r *reader) HasNext() bool {
if !r.lastMessageInBroker.IsZero() && r.hasMoreMessages() {
return true
}
for {
lastMsgID, err := r.pc.getLastMessageID()
if err != nil {
r.log.WithError(err).Error("Failed to get last message
id from broker")
continue
} else {
r.lastMessageInBroker = lastMsgID
break
}
}
return r.hasMoreMessages()
}
```
It will determine whether there is a next message based on getLastMessageID
----------------------------------------------------------------
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]