Skip to content

[Issue 1297][consumer] Fix DLQ producer name conflicts when there are same name consumers - #1314

Merged
crossoverJie merged 1 commit into
apache:masterfrom
geniusjoe:dev/update-dlq-name
Dec 9, 2024
Merged

crossoverJie merged 1 commit into
apache:masterfrom
geniusjoe:dev/update-dlq-name

Conversation

@geniusjoe

Copy link
Copy Markdown
Contributor

Fixes #1297
Master Issue: apache/pulsar#21589

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

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

  • Make sure that the change passes the CI checks.
    This change is already covered by existing tests, such as pulsar/consumer_test.go#TestDLQ(t *testing.T)

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (no)
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)
    I will create a followup issue for adding the documentation later.

@crossoverJie crossoverJie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] DLQ producer name conflicts when same name consumer sends messages to DLQ

2 participants