ivankelly commented on a change in pull request #1861: Cpp client: add
getLastMessageId and hasMessageAvailable in consmer and reader
URL: https://github.com/apache/incubator-pulsar/pull/1861#discussion_r196827159
##########
File path: pulsar-client-cpp/lib/ConsumerImpl.cc
##########
@@ -923,4 +924,75 @@ void ConsumerImpl::seekAsync(const MessageId& msgId,
ResultCallback callback) {
bool ConsumerImpl::isReadCompacted() { return readCompacted_; }
+void ConsumerImpl::hasMessageAvailableAsync(HasMessageAvailableCallback
callback) {
+ MessageId lastDequed = this->lastMessageIdDequed();
+ MessageId lastInBroker = this->lastMessageIdInBroker();
+ if (lastInBroker > lastDequed && lastInBroker.entryId() != -1) {
Review comment:
What about the case where the broker a lot of messages, but has just
recently rolled the ledger?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services