BewareMyPower commented on code in PR #18633:
URL: https://github.com/apache/pulsar/pull/18633#discussion_r1039101336


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicsConsumerImplTest.java:
##########
@@ -539,6 +540,38 @@ public void testTopicNameValid() throws Exception{
         }).get();
     }
 
+    @Test
+    public void testExclusiveSubscribe() throws Exception {
+        final String topicName = 
"persistent://prop/use/ns-abc/testTopicNameValid";
+        TenantInfoImpl tenantInfo = createDefaultTenantInfo();
+        admin.tenants().createTenant("prop", tenantInfo);
+        admin.topics().createPartitionedTopic(topicName, 3);
+        List<Integer> partitions = new ArrayList<>();
+        for (int i = 0; i < 3; i++) {
+            partitions.add(i);
+        }
+        List<String> realTopics = partitions.stream()
+                .map(idx -> topicName + "-partition-" + idx)
+                .collect(Collectors.toList());
+        Consumer<byte[]> consumer1 = pulsarClient.newConsumer()
+                .topics(realTopics)

Review Comment:
   @lordcheng10 `consumer1` could subscribe the partitioned topic. Here is the 
test result without your patch.
   
   
![image](https://user-images.githubusercontent.com/18204803/205539082-fa6075b8-0fd4-4e53-8b5b-b18b6d8e1a89.png)
   
   BTW, you can simplify the `consumer2` creation like:
   
   ```java
                       .topics(IntStream.range(0, 3).mapToObj(i -> topicName + 
"-partition-" + i)
                               .collect(Collectors.toList()))
   ```



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