wuYin opened a new pull request #386:
URL: https://github.com/apache/pulsar-client-go/pull/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
   
   - [ ] Make sure that the change passes the CI checks.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to