eolivelli commented on a change in pull request #10129:
URL: https://github.com/apache/pulsar/pull/10129#discussion_r610487371



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -121,8 +117,29 @@ public ConsumerBuilderImpl(PulsarClientImpl client, 
Schema<T> schema) {
         }
         if(conf.isRetryEnable() && conf.getTopicNames().size() > 0 ) {
             TopicName topicFirst = 
TopicName.get(conf.getTopicNames().iterator().next());
-            String retryLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
-            String deadLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            String retryLetterTopic = topicFirst + "-" + 
conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String deadLetterTopic = topicFirst + "-" + 
conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+
+            //Issue 9327: do compatibility check in case of the default retry 
and dead letter topic name changed
+            String oldRetryLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String oldDeadLetterTopic = topicFirst.getNamespace() + "/" + 
conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
+            try {
+                PartitionedTopicMetadata partitionedTopicMetadata = 
client.getLookup().getPartitionedTopicMetadata(TopicName.get(oldRetryLetterTopic)).get();
+                if (partitionedTopicMetadata.partitions > 0) {
+                    retryLetterTopic = oldRetryLetterTopic;
+                }
+            } catch (Exception e) {
+                // oldRetryLetterTopic not exist, do nothing

Review comment:
       can we check for the exact error ?
   otherwise even a network error may fall into this case




-- 
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:
us...@infra.apache.org


Reply via email to