Skip to content
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

expose getLastMessageId method in ConsumerImpl #4911

Merged
merged 3 commits into from
Aug 18, 2019

Conversation

jiazhai
Copy link
Member

@jiazhai jiazhai commented Aug 7, 2019

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

@jiazhai jiazhai added this to the 2.5.0 milestone Aug 7, 2019
@jiazhai jiazhai self-assigned this Aug 7, 2019
@jiazhai
Copy link
Member Author

jiazhai commented Aug 12, 2019

@sijie Thanks. updated following your comments.

@jiazhai
Copy link
Member Author

jiazhai commented Aug 13, 2019

run java8 tests


int currentResult = entry.getValue().compareTo(otherMessage);
if (result == 0) {
result = currentResult;
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. result == 0 && currentResult ==0, then this reset has no effect.
  2. result ==0 && currentResult !=0, then we keep the non-zero result, this is the result that may be finally returned.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

@codelipenghui codelipenghui left a 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

@sijie sijie merged commit 93d95c7 into apache:master Aug 18, 2019
@wolfstudy wolfstudy modified the milestones: 2.5.0, 2.4.2 Nov 20, 2019
wolfstudy pushed a commit that referenced this pull request Nov 20, 2019
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose getLastMessageId method from consumerImpl
4 participants