liangyepianzhou commented on code in PR #17777:
URL: https://github.com/apache/pulsar/pull/17777#discussion_r983129636
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/transaction/TransactionTest.java:
##########
@@ -318,6 +319,84 @@ public Consumer<byte[]> getConsumer(String topicName,
String subName) throws Pul
.subscribe();
}
+ @Test
+ public void testAsyncSendOrAckForSingleFuture() throws Exception {
+ String topic = NAMESPACE1 + "/testSingleFuture";
+ int totalMessage = 10;
+ int threadSize = 30;
+ String topicName = "subscription";
+
getPulsarServiceList().get(0).getConfig().setBrokerDeduplicationEnabled(false);
+ ExecutorService executorService =
Executors.newFixedThreadPool(threadSize);
+
+ //build producer/consumer
+ Producer<byte[]> producer = pulsarClient.newProducer()
+ .topic(topic)
+ .producerName("producer")
+ .sendTimeout(0, TimeUnit.SECONDS)
+ .create();
+
+ Consumer<byte[]> consumer = pulsarClient.newConsumer()
+ .topic(topic)
+ .subscriptionType(SubscriptionType.Exclusive)
+ .subscriptionName(topicName)
+ .subscribe();
+ //store the send/ack result futures
+ ArrayList<CompletableFuture<MessageId>> sendFutures = new
ArrayList<>();
+ ArrayList<CompletableFuture<Void>> ackFutures = new ArrayList<>();
+
+ //send and ack messages with transaction
+ Transaction transaction = pulsarClient.newTransaction()
+ .withTransactionTimeout(10, TimeUnit.SECONDS)
+ .build()
+ .get();
+
+ for (int i = 0; i < totalMessage * threadSize; i++) {
+ producer.newMessage().send();
+ }
+
+ CountDownLatch countDownLatch = new CountDownLatch(threadSize);
+ new Thread(() -> {
Review Comment:
Delete it.
--
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]