codelipenghui commented on a change in pull request #9743:
URL: https://github.com/apache/pulsar/pull/9743#discussion_r584386396



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -119,10 +119,12 @@ public ConsumerBuilderImpl(PulsarClientImpl client, 
Schema<T> schema) {
             return FutureUtil.failedFuture(
                     new InvalidConfigurationException("KeySharedPolicy must 
set with KeyShared subscription"));
         }
-        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;
+        if (conf.isRetryEnable() && conf.getTopicNames().size() > 0 ) {
+            String topicName = 
TopicName.get(conf.getTopicNames().iterator().next()).getPartitionedTopicName();
+            String retryLetterTopic = topicName + "-" + 
conf.getSubscriptionName()
+                    + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
+            String deadLetterTopic = topicName + "-" + 
conf.getSubscriptionName()
+                    + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;

Review comment:
       Topics might not belong to a partitioned topic since we can use 
`.topic("persistent://my-tenant/my-ns/topic-a", 
"persistent://my-tenant/my-ns/topic-b", 
"persistent://my-tenant/my-ns/topic-c")`. This is why the default retry topic 
name does not contains the topic(the topic name is written to the properties of 
the message when send it to the retry topic).
   
   You can explicitly specify the retry topic name or the dead letter topic 
name through the dead letter policy.




----------------------------------------------------------------
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