nodece commented on code in PR #1412:
URL: https://github.com/apache/pulsar-client-go/pull/1412#discussion_r2304749321
##########
pulsar/consumer_impl.go:
##########
@@ -181,8 +181,17 @@ func newConsumer(client *client, options ConsumerOptions)
(Consumer, error) {
}
}
- dlq, err := newDlqRouter(client, options.DLQ, options.Topic,
options.SubscriptionName, options.Name,
- options.BackOffPolicyFunc, client.log)
+ var dlq *dlqRouter
+ var err error
+ if options.RetryEnable && len(options.Topics) == 2 && options.Topics[1]
== options.DLQ.RetryLetterTopic {
+ // when RetryEnable=true, options.Topic and
RetryLetterTopic will be appended to the options.Topics
+ // we need to try to find previous options.Topic from
options.Topics
+ dlq, err = newDlqRouter(client, options.DLQ, options.Topics[0],
options.SubscriptionName, options.Name,
+ options.BackOffPolicyFunc, client.log)
+ } else {
+ dlq, err = newDlqRouter(client, options.DLQ, options.Topic,
options.SubscriptionName, options.Name,
+ options.BackOffPolicyFunc, client.log)
+ }
Review Comment:
```suggestion
var dlqTopic string
if options.RetryEnable && len(options.Topics) == 2 && options.Topics[1]
== options.DLQ.RetryLetterTopic {
// when RetryEnable=true, options.Topic and
RetryLetterTopic will be appended to the options.Topics
// we need to try to find previous options.Topic from
options.Topics
dlqTopic = options.Topics[0]
} else {
dlqTopic = options.Topic
}
dlq, err = newDlqRouter(client, options.DLQ, dlqTopic,
options.SubscriptionName, options.Name,
options.BackOffPolicyFunc, client.log)
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]