-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][client] Fix for early hit beforeConsume
for MultiTopicConsumer
#23141
[fix][client] Fix for early hit beforeConsume
for MultiTopicConsumer
#23141
Conversation
@coderzc Please add the following content to your PR description and select a checkbox:
|
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.
The fix for beforeConsume
method looks good.
@coderzc Could you please help also check other methods in the ConsumerInterceptor to make sure they are working as expected without issues like beforeConsume
method.
pulsar-broker/src/test/java/org/apache/pulsar/client/api/InterceptorsTest.java
Outdated
Show resolved
Hide resolved
8cccceb
to
8eaf5c6
Compare
I checked other methods in the ConsumerInterceptor, they work well. |
9bf5427
to
202b943
Compare
7c3d04e
to
c575886
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23141 +/- ##
============================================
+ Coverage 73.57% 74.55% +0.98%
- Complexity 32624 34093 +1469
============================================
Files 1877 1919 +42
Lines 139502 144287 +4785
Branches 15299 15778 +479
============================================
+ Hits 102638 107576 +4938
+ Misses 28908 28467 -441
- Partials 7956 8244 +288
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@codelipenghui PTAL~ |
apache#23141) (cherry picked from commit c07b158)
apache#23141) (cherry picked from commit c07b158) (cherry picked from commit 69a6232)
apache#23141) (cherry picked from commit c07b158) (cherry picked from commit 69a6232)
apache#23141) (cherry picked from commit c07b158) (cherry picked from commit 69a6232)
Motivation
When using MultiTopicConsumer with ConsumerInterceptor , the
beforeConsume
method was hit many timesbefore receiving the first message. The root cause of this is that before the MultiTopicsConsumer receives the message, MultiTopicsConsumer has already completed receiving the message from the internal consumer and executed the
beforeConsume
method, so we can letbeforeConsume
be called in MultiTopicsConsumer to avoid this issue.pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
Lines 228 to 254 in 8707fbe
Modifications
beforeConsume
method in MultiTopicsConsumer.beforeConsume
logicVerifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: