-
Notifications
You must be signed in to change notification settings - Fork 345
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reconsume broken while using non-FQDN topics (#386)
### Issue Retry policy not effective with non-FQDN topic. - reproduction ```go client, _ := pulsar.NewClient(pulsar.ClientOptions{URL: "pulsar://localhost:6650"}) consumer, _ := client.Subscribe(pulsar.ConsumerOptions{ Topic: "topic-01", SubscriptionName: "my-sub", RetryEnable: true, DLQ: &pulsar.DLQPolicy{MaxDeliveries: 2}, }) msg, _ := consumer.Receive(context.Background()) consumer.ReconsumeLater(msg, 5*time.Second) ``` - logs ``` RN[0000] consumer of topic [persistent://public/default/topic-01] not exist unexpectedly topic="[topic-01 persistent://public/default/my-sub-RETRY]" ``` ### Cause For MultiTopicConsumer `consumers` map filed: - key: user provided topic, maybe non-FQDN. - value: consumer instance. `ReconsumeLater` using msg's FQDN topic as key to find `consumer` in `consumers`, if mismatch with non-FQDN topic, this invoke will be ignored, lead to Retry policy not effective. ### Modifications - Normalize user provided topics as FQDN topics before initializing consumers. - Add non-FQDN topic consumption case in Retry policy tests. ### Verifying this change - [x] Make sure that the change passes the CI checks.
- Loading branch information
Showing
3 changed files
with
19 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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