eolivelli commented on code in PR #15852:
URL: https://github.com/apache/pulsar/pull/15852#discussion_r885530079
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/ZeroQueueSizeTest.java:
##########
@@ -546,4 +550,53 @@ public void testPauseAndResumeNoReconnection() throws
Exception {
assertEquals(receivedMessages.get(i).intValue(), i);
}
}
+
+ @Test(timeOut = 10000)
+ public void testReceiveAsyncWhenUnloadTopic() throws
PulsarClientException, ExecutionException, InterruptedException {
+ final String topicName = "persistent://prop/cluster/namespace/topic-"
+ UUID.randomUUID();
+ int messageNumber = 500;
+ List<MessageId> messages = Collections.synchronizedList(new
ArrayList<>());
+ @Cleanup
+ Consumer<byte[]> subscribe = pulsarClient.newConsumer()
+ .topic(topicName)
+ .subscriptionName("sub-11")
+ .subscriptionType(SubscriptionType.Shared)
+ .receiverQueueSize(0)
+ .consumerName("con-11")
+ .subscribe();
+
+ @Cleanup
+ Producer<byte[]> producer = pulsarClient.newProducer()
+ .enableBatching(false)
+ .messageRoutingMode(MessageRoutingMode.RoundRobinPartition)
+ .topic(topicName).create();
+ for (int i = 0; i < messageNumber; i++) {
+ MessageId msgId = producer.newMessage()
+
.value(UUID.randomUUID().toString().getBytes(StandardCharsets.UTF_8))
+ .send();
+ messages.add(msgId);
+ }
+
+ @Cleanup("shutdown")
+ ScheduledExecutorService executorService =
Executors.newSingleThreadScheduledExecutor();
+ executorService.scheduleWithFixedDelay(()-> {
Review Comment:
why are you using 'scheduleWithFixedDelay'?
are you trying to execute `unload` in parallel with `receiveAsync` ?
--
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]