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/08/10 05:47:22 UTC

[GitHub] [pulsar] eolivelli commented on a change in pull request #11613: avoid non-durable subscription misuse an existed durable subscription

eolivelli commented on a change in pull request #11613:
URL: https://github.com/apache/pulsar/pull/11613#discussion_r685707535



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonDurableSubscriptionTest.java
##########
@@ -94,6 +94,53 @@ public void testNonDurableSubscription() throws Exception {
 
     }
 
+    @Test
+    public void testSameSubscriptionNameForDurableAndNonDurableSubscription() throws Exception {
+        String topicName = "persistent://my-property/my-ns/same-sub-name-topic";
+        // 1 setup producer and consumer
+        @Cleanup
+        Producer<String> producer = pulsarClient.newProducer(Schema.STRING).topic(topicName)
+                .create();
+
+        @Cleanup
+        Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topicName)
+                .readCompacted(true)
+                .subscriptionMode(SubscriptionMode.Durable)
+                .subscriptionType(SubscriptionType.Exclusive)
+                .subscriptionName("mix-subscription")
+                .subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
+                .subscribe();
+
+        // 2 send 10 messages

Review comment:
       why do we need to send all these messages ?
   
   isn't it enough to only create a Consumer and a Reader with the same subscription name ?
   
   we can also make it simpler and more explicit to create:
   - 1 Consumer with SubscriptionMode.Durable
   - 1 Consumer with SubscriptionMode.NonDurable
   
   




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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org