rdhabalia commented on a change in pull request #2400: PIP-22: Dead Letter Topic
URL: https://github.com/apache/incubator-pulsar/pull/2400#discussion_r212497283
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
 ##########
 @@ -132,11 +156,44 @@ public synchronized void addConsumer(Consumer consumer) 
throws BrokerServiceExce
             throw new ConsumerBusyException("Subscription reached max 
consumers limit");
         }
 
+        deadLetterTopicProducer = newDeadLetterProducer();
+
         consumerList.add(consumer);
         consumerList.sort((c1, c2) -> c1.getPriorityLevel() - 
c2.getPriorityLevel());
         consumerSet.add(consumer);
     }
 
+    private ProducerImpl<byte[]> newDeadLetterProducer() throws 
BrokerServiceException {
+        if (maxRedeliveryCount > 0 && deadLetterTopicProducer == null) {
+            try {
+                if (maxRedeliveryCount > 0 && 
StringUtils.isBlank(deadLetterTopic)) {
+                    deadLetterTopic = String.format("%s-%s-DLQ", 
topic.getName(), Codec.decode(cursor.getName()));
 
 Review comment:
   what if tenant already has topic with postfix `DLQ`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to