jiazhai commented on a change in pull request #2400: PIP-22: Dead Letter Topic URL: https://github.com/apache/incubator-pulsar/pull/2400#discussion_r212514520
########## 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: Seems it is up to application to decide. In this change, application can choose its own name, and only use “-DLQ” when the application doesn’t specify. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services