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 partitioned topic #425

Merged
merged 1 commit into from
Jan 4, 2021

Conversation

wuYin
Copy link
Contributor

@wuYin wuYin commented Dec 21, 2020

Issue

Retry policy not effective with partitioned topic.

  • reproduction
    topic-01 have 2 partitions:

     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

    WARN[0000] consumer of topic [persistent://public/default/topic-01-partition-0] not exist unexpectedly  topic=" [persistent://public/default/topic-01 persistent://platform/psr/my-sub-RETRY]"
    

Cause

For MultiTopicConsumer consumers map filed:

  • key: FQDN topics, without partition number suffix.
  • value: consumer instance.

ReconsumeLater using msg's partition number suffix topic as key, to find consumer in consumers, but allways not found, lead to Retry policy not effective.

Modifications

  • Trim partition number in partitioned topic before using it

Verifying this change

  • Make sure that the change passes the CI checks.

@wuYin wuYin changed the title fix retry policy not effective with partitioned topic Fix retry policy not effective with partitioned topic Dec 21, 2020
@wolfstudy wolfstudy added this to the 0.4.0 milestone Dec 21, 2020
@wolfstudy wolfstudy merged commit 2ee34f3 into apache:master Jan 4, 2021
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