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 2019/11/11 11:55:58 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #5603: Add retry when create producer async

sijie commented on a change in pull request #5603: Add retry when create producer async
URL: https://github.com/apache/pulsar/pull/5603#discussion_r344676850
 
 

 ##########
 File path: pulsar-broker/src/test/java/org/apache/pulsar/stats/client/PulsarBrokerStatsClientTest.java
 ##########
 @@ -132,5 +135,61 @@ public void testTopicInternalStats() throws Exception {
         log.info("-- Exiting {} test --", methodName);
     }
 
+    @Test
+    public void testGetPartitionedTopicMetaData() throws Exception {
+        log.info("-- Starting {} test --", methodName);
+
+        final String topicName = "persistent://my-property/my-ns/my-topic1";
+        final String subscriptionName = "my-subscriber-name";
+
+
+
+        try {
+            String url = "http://localhost:51000,localhost:" + BROKER_WEBSERVICE_PORT;
+            if (isTcpLookup) {
+                url = "pulsar://localhost:51000,localhost:" + BROKER_PORT;
+            }
+            PulsarClient client = newPulsarClient(url, 0);
+
+            Consumer<byte[]> consumer = client.newConsumer().topic(topicName).subscriptionName(subscriptionName)
+                    .acknowledgmentGroupTime(0, TimeUnit.SECONDS).subscribe();
+            Producer<byte[]> producer = client.newProducer().topic(topicName).create();
+
+            consumer.close();
+            producer.close();
+            client.close();
+        } catch (PulsarClientException pce) {
+            log.error("create producer or consumer error: ", pce);
+            fail();
+        }
+
+        try {
+
+            String url = "http://localhost:51000,localhost:51001";
+            if (isTcpLookup) {
+                url = "pulsar://localhost:51000,localhost:51001";
+            }
+//            PulsarClient client = newPulsarClient(url, 0);
+            PulsarClient client = PulsarClient.builder()
+                    .serviceUrl(url)
+                    .statsInterval(0, TimeUnit.SECONDS)
+                    .operationTimeout(3, TimeUnit.SECONDS)
+                    .build();
+
+            Consumer<byte[]> consumer = client.newConsumer().topic(topicName).subscriptionName(subscriptionName)
+                    .acknowledgmentGroupTime(0, TimeUnit.SECONDS).subscribe();
 
 Review comment:
   Add `faill()` after creating a consumer since the consumer will never be created, no?

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


With regards,
Apache Git Services