-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add close method in the class of NegativeAcksTracker #12469
Conversation
@lordcheng10:Thanks for your contribution. For this PR, do we need to update docs? |
No need to add documentation |
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Show resolved
Hide resolved
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.
ConsumerImplTest.testClose method has been added. Please review again,thanks! @codelipenghui |
Exception checkException = null; | ||
try { | ||
if (consumer != null) { | ||
consumer.close(); | ||
} | ||
} catch (Exception e) { | ||
checkException = e; | ||
} | ||
Assert.assertNull(checkException); |
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.
Please confirm the timeout==null and the displayedMessages== null in the Tracker
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.
By default timeout is null and the nackedMessages is null. By calling consumer.negativeAcknowledge(new MessageIdImpl(-1, -1, -1)) to make timeout != null and nackedMessages != null .
Please review again,thanks! @315157973
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.
Then why not close Consumer after calling consumer.negativeAcknowledge?
Your unit test has no way to confirm that the Tracker is closed, and we can't even confirm that the close method has been called.
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.
you are right! I resubmitted the modification: close Consumer after calling consumer.negativeAcknowledge:
public void testClose() {
Exception checkException = null;
try {
if (consumer != null) {
consumer.negativeAcknowledge(new MessageIdImpl(-1, -1, -1));
consumer.close();
}
} catch (Exception e) {
checkException = e;
}
Assert.assertNull(checkException);
}
Please review again,thanks! @315157973
…egativeAcksTracker. By default timeout is null and the nackedMessages is null.
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
2 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
1 similar comment
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
3 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
@codelipenghui PTAL,thanks! |
@codelipenghui 's comment has been addressed. Merged to master branch |
(cherry picked from commit 3694aa1)
(cherry picked from commit 3694aa1)
Add close method in the class of NegativeAcksTracker