fix: add DLQPolicy.DeadLetterTopicProducerName#1417
Merged
crossoverJie merged 4 commits intoapache:masterfrom Sep 4, 2025
Merged
fix: add DLQPolicy.DeadLetterTopicProducerName#1417crossoverJie merged 4 commits intoapache:masterfrom
crossoverJie merged 4 commits intoapache:masterfrom
Conversation
… instead of the RLQ producer name
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the DLQ (Dead Letter Queue) producer incorrectly uses the RLQ (Retry Letter Queue) producer name when sending messages to the DLQ topic. The fix adds a new DeadLetterTopicProducerName field to the DLQPolicy struct to allow specifying a custom producer name for the DLQ or letting the system generate one using the existing naming pattern.
- Adds
DeadLetterTopicProducerNamefield toDLQPolicystruct for configuring DLQ producer names - Updates DLQ router logic to use the new field instead of incorrectly using RLQ producer name
- Adds comprehensive integration tests to verify both custom and auto-generated DLQ producer names
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pulsar/consumer.go | Adds the new DeadLetterTopicProducerName field to the DLQPolicy struct with documentation |
| pulsar/dlq_router.go | Updates producer name logic to check and use the new DeadLetterTopicProducerName field |
| pulsar/consumer_test.go | Adds two integration tests to verify the new functionality works correctly |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Contributor
Author
|
Looks like CI failed with a timeout in the |
crossoverJie
approved these changes
Sep 4, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
When the retry mechanism is enabled, the RLQ producer first sends messages to the RLQ topic using the producer name if passed in the producer options inside the
DLQPolicy.However, with
DLQPolicy.ProducerOptions.Nameset, when the delivery count is reached and the consumerNack()the messages, the DLQ producer sending messages to the DLQ uses RLQ producer name.This is an issue, especially for message deduplication process where each producers must have a globally unique name for a given topic.
Modifications
This PR adds the
DeadLetterTopicProducerNamefield to theDLQPolicyin order to either allow using a custom producer name or let the client create the producer name with the existing naming pattern.Verifying this change
TestWithoutDeadLetterTopicDeadLetterTopicProducerNameTestWithDeadLetterTopicDeadLetterTopicProducerNameDoes this pull request potentially affect one of the following parts:
Documentation
DeadLetterTopicProducerNamefield added is documented where it's defined in theDLQPolicystruct