-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[fix][client] Fix DLQ producer name conflicts when there are same name consumers #23577
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Can you add a test to verify this case that the consumer name is specified? |
8b0d001
to
7009d19
Compare
@hanmz |
zjxxzjwang
approved these changes
Nov 18, 2024
RobertIndie
reviewed
Nov 18, 2024
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
Outdated
Show resolved
Hide resolved
7009d19
to
237e4ac
Compare
237e4ac
to
ce3ce7e
Compare
RobertIndie
approved these changes
Nov 20, 2024
Jason918
approved these changes
Nov 25, 2024
lhotari
reviewed
Nov 25, 2024
This doesn't apply to 3.0.x since it doesn't include #21589 |
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
cherry-picked/branch-3.3
cherry-picked/branch-4.0
doc-required
Your PR changes impact docs and you will update later.
release/3.3.3
release/4.0.1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Main Issue: apache/pulsar-client-go#1297
Relative #21890
Motivation
When multiple consumers with same name are using dlq policies at the same time, prompt will throw below exceptions:
ERRO[0069] Failed to create DLQ producer dlq-topic="persistent://<tenant>/<namespace>/<topic>-<subscription>-DLQ" error="server error: ProducerBusy: org.apache.pulsar.broker.service.BrokerServiceException$NamingException: Producer with name '-<subscription>-<consumerName>-DLQ' is already connected to topic"
Modifications
I think maybe we need to add a random suffix in dlq producer name like:
opt.Name = fmt.Sprintf("%s-%s-%s-%s-DLQ", r.topicName, r.subscriptionName, r.consumerName, generateRandomName())
Verifying this change
This change is already covered by existing tests, such as
DeadLetterTopicTest.testDeadLetterTopicWithProducerName
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
After change golang, java and c++ sdks, we could update document like this pr https://github.com/apache/pulsar-site/pull/772/files.
Matching PR in forked repository
PR in forked repository: