poorbarcode commented on code in PR #20591:
URL: https://github.com/apache/pulsar/pull/20591#discussion_r1232048190


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java:
##########
@@ -340,6 +343,58 @@ public Object[][] codecProvider() {
         return new Object[][] { { 0 }, { 1000 } };
     }
 
+    @Test
+    public void testConsumerReconnectTwice() throws Exception {
+        final String topicName = 
BrokerTestUtil.newUniqueName("persistent://my-property/my-ns/tp_");
+        final String subscriptionName = "subscription1";
+        admin.topics().createNonPartitionedTopic(topicName);
+        admin.topics().createSubscription(topicName, subscriptionName, 
MessageId.earliest);
+        // Create producer and consumer.
+        ConsumerImpl<String> consumer = (ConsumerImpl<String>) 
pulsarClient.newConsumer(Schema.STRING)
+                .subscriptionType(SubscriptionType.Shared)

Review Comment:
   > Why did you use Shared subcription?
   
   Just to make this test exactly the same as the example in the motivation( if 
use`Exclusive`, pulsar will not record the  `unackMessages` of the consumers). 
see: 
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java#L1067
   
   **(Highlight)**Already add all subscription types by the parameter provider.



##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java:
##########
@@ -340,6 +343,58 @@ public Object[][] codecProvider() {
         return new Object[][] { { 0 }, { 1000 } };
     }
 
+    @Test
+    public void testConsumerReconnectTwice() throws Exception {
+        final String topicName = 
BrokerTestUtil.newUniqueName("persistent://my-property/my-ns/tp_");
+        final String subscriptionName = "subscription1";
+        admin.topics().createNonPartitionedTopic(topicName);
+        admin.topics().createSubscription(topicName, subscriptionName, 
MessageId.earliest);
+        // Create producer and consumer.
+        ConsumerImpl<String> consumer = (ConsumerImpl<String>) 
pulsarClient.newConsumer(Schema.STRING)
+                .subscriptionType(SubscriptionType.Shared)

Review Comment:
   > Why did you use Shared subcription?
   
   Just to make this test exactly the same as the example in the motivation( if 
use`Exclusive`, pulsar will not record the  `unackMessages` of the consumers). 
see: 
https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java#L1067
   
   **(Highlight)** Already add all subscription types by the parameter provider.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to