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 06:25:24 UTC

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

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



##########
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:
       Oh, yes, you're right.
   This test is firstly used for showing the behaviour before this pull request, at that point the reader start from the eariliest only can read 5 messages.
   After this pull request, it seems no need to keep this logic. 




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