-
Notifications
You must be signed in to change notification settings - Fork 3.6k
expose getLastMessageId method in ConsumerImpl #4911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java
Outdated
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiMessageIdImpl.java
Outdated
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiMessageIdImpl.java
Show resolved
Hide resolved
@sijie Thanks. updated following your comments. |
run java8 tests |
|
||
int currentResult = entry.getValue().compareTo(otherMessage); | ||
if (result == 0) { | ||
result = currentResult; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic here is problematic. This resets the result back to latest result.
a MultipleMessageId is larger than the other one is when all the partitions' messageId is larger or equals to the messageIds, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- result == 0 && currentResult ==0, then this reset has no effect.
- result ==0 && currentResult !=0, then we keep the non-zero result, this is the result that may be finally returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good to me
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiMessageIdImpl.java
Show resolved
Hide resolved
Fixes #4909 ### Motivation It would be good to expose method `getLastMessageId` in `ConsumerImpl` to a public method. eg. some times user would like to know the lag messages; or only consume messages before current time. ### Modifications - expose method `getLastMessageId` in consumer api. - add unit test. ### Verifying this change Ut passed (cherry picked from commit 93d95c7)
Fixes #4909
Motivation
It would be good to expose method
getLastMessageId
inConsumerImpl
to a public method.eg. some times user would like to know the lag messages; or only consume messages before current time.
Modifications
getLastMessageId
in consumer api.Verifying this change
Ut passed