wenbingshen commented on a change in pull request #14602:
URL: https://github.com/apache/pulsar/pull/14602#discussion_r825580575
##########
File path:
pulsar-broker/src/test/java/org/apache/pulsar/client/api/SimpleProducerConsumerTest.java
##########
@@ -606,6 +607,82 @@ public void testSendTimeout(int batchMessageDelayMs)
throws Exception {
log.info("-- Exiting {} test --", methodName);
}
+ @Test(dataProvider = "batch")
+ public void testSendTimeoutAndRecover(int batchMessageDelayMs) throws
Exception {
+ log.info("-- Starting {} test --", methodName);
+
+ int numPartitions = 6;
+ TopicName topicName =
TopicName.get("persistent://my-property/my-ns/sendTimeoutAndRecover-1");
+ admin.topics().createPartitionedTopic(topicName.toString(),
numPartitions);
+
+ Consumer<byte[]> consumer =
pulsarClient.newConsumer().topic(topicName.toString())
+ .subscriptionName("my-subscriber-name").subscribe();
+ ProducerBuilder<byte[]> producerBuilder = pulsarClient.newProducer()
+ .topic(topicName.toString()).sendTimeout(1, TimeUnit.SECONDS);
+
+ if (batchMessageDelayMs != 0) {
+ producerBuilder.enableBatching(true);
+ producerBuilder.batchingMaxPublishDelay(batchMessageDelayMs,
TimeUnit.MILLISECONDS);
+ producerBuilder.batchingMaxMessages(5);
+ }
+ PartitionedProducerImpl<byte[]> partitionedProducer =
+ (PartitionedProducerImpl<byte[]>) producerBuilder.create();
+ final String message = "my-message";
+
+ // 1. Trigger the send timeout
+ stopBroker();
Review comment:
I still want to use stop/start broker to test send timeout because we
need to test `multi-partition` producers, otherwise we need to set `auto_read`
config to the channel for each producer.
--
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]