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


##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ConnectionPoolTest.java:
##########
@@ -80,6 +84,33 @@ public void testSingleIpAddress() throws Exception {
         eventLoop.shutdownGracefully();
     }
 
+    @Test
+    public void testSelectConnectionForSameProducer() throws Exception {
+        final String topicName = 
BrokerTestUtil.newUniqueName("persistent://sample/standalone/ns/tp_");
+        admin.topics().createNonPartitionedTopic(topicName);
+        final CommandCloseProducer commandCloseProducer = new 
CommandCloseProducer();
+        // 10 connection per broker.
+        final PulsarClient clientWith10ConPerBroker = 
PulsarClient.builder().connectionsPerBroker(10)
+                        .serviceUrl(lookupUrl.toString()).build();
+        ProducerImpl producer = (ProducerImpl) 
clientWith10ConPerBroker.newProducer().topic(topicName).create();
+        commandCloseProducer.setProducerId(producer.producerId);
+        // An error will be reported when the Producer reconnects using a 
different connection.
+        // If no error is reported, the same connection was used when 
reconnecting.
+        for (int i = 0; i < 20; i++) {
+            // Trigger reconnect
+            producer.getClientCnx().handleCloseProducer(commandCloseProducer);

Review Comment:
   fixed



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