sijie commented on a change in pull request #2400: Dead Letter Topic
URL: https://github.com/apache/incubator-pulsar/pull/2400#discussion_r211357018
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
 ##########
 @@ -132,11 +160,45 @@ 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()));
+                }
+                return (ProducerImpl<byte[]>) 
topic.getBrokerService().pulsar().getClient().newProducer(Schema.BYTES)
+                        .topic(deadLetterTopic)
+                        .enableBatching(false)
 
 Review comment:
   any thoughts about why you need to disable batching?

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