Skip to content
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 retry policy not effective with non-FQDN topics #386

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

wuYin
Copy link
Contributor

@wuYin wuYin commented Nov 5, 2020

Issue

Retry policy not effective with non-FQDN topic.

  • reproduction

     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

  • Make sure that the change passes the CI checks.

@wolfstudy wolfstudy requested review from wolfstudy and merlimat and removed request for wolfstudy November 5, 2020 08:46
@wolfstudy wolfstudy added this to the 0.3.0 milestone Nov 5, 2020
@wolfstudy wolfstudy merged commit 8465c55 into apache:master Nov 5, 2020
Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

LGTM

@wuYin wuYin deleted the fix-reconsume branch November 5, 2020 09:39
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.

2 participants