You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/01/18 15:47:23 UTC

[GitHub] [pulsar] 315157973 commented on a change in pull request #9163: Avoid enable DLQ on Key_Shared subscription.

315157973 commented on a change in pull request #9163:
URL: https://github.com/apache/pulsar/pull/9163#discussion_r559656078



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
##########
@@ -123,21 +123,31 @@ public ConsumerBuilderImpl(PulsarClientImpl client, Schema<T> schema) {
             String retryLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.RETRY_GROUP_TOPIC_SUFFIX;
             String deadLetterTopic = topicFirst.getNamespace() + "/" + conf.getSubscriptionName() + RetryMessageUtil.DLQ_GROUP_TOPIC_SUFFIX;
             if(conf.getDeadLetterPolicy() == null) {
-                conf.setDeadLetterPolicy(DeadLetterPolicy.builder()
-                                        .maxRedeliverCount(RetryMessageUtil.MAX_RECONSUMETIMES)
-                                        .retryLetterTopic(retryLetterTopic)
-                                        .deadLetterTopic(deadLetterTopic)
-                                        .build());
+                DeadLetterPolicy.DeadLetterPolicyBuilder dlpBuilder = DeadLetterPolicy.builder()
+                        .maxRedeliverCount(RetryMessageUtil.MAX_RECONSUMETIMES)
+                        .retryLetterTopic(retryLetterTopic);
+                // Don't set DLQ for key shared subType since it requires msg to be ordered for key.
+                if (conf.getSubscriptionType() != SubscriptionType.Key_Shared) {

Review comment:
       I have a question, should we guarantee 2 points:
   1) deadLetterProducer is not created
   2) The local queue does not save any dead letters
   Therefore, is it necessary to prohibit setting DLQ names?
   At line 333 in `ConsumerImpl.java`, the logic seems to conflict with this. As long as DLQ is set, the value will be set regardless of whether key-share




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