zhangjidi2016 commented on a change in pull request #266:
URL: https://github.com/apache/rocketmq-spring/pull/266#discussion_r437104075



##########
File path: 
rocketmq-spring-boot/src/test/java/org/apache/rocketmq/spring/core/RocketMQTemplateTest.java
##########
@@ -87,6 +94,38 @@ public void testSendMessage() {
         }
     }
 
+    @Test
+    public void testSendMessage_withCustomAsyncSenderExecutor() {
+        ExecutorService executorService = new ThreadPoolExecutor(
+            2,
+            5,
+            100,
+            TimeUnit.SECONDS,
+            new ArrayBlockingQueue<Runnable>(2000),
+            new ThreadFactory() {
+                private AtomicInteger threadIndex = new AtomicInteger(0);
+
+                @Override
+                public Thread newThread(Runnable r) {
+                    return new Thread(r, "AsyncSenderExecutor_" + 
this.threadIndex.incrementAndGet());
+                }
+            });
+        rocketMQTemplate.setAsyncSenderExecutor(executorService);
+        try {
+            rocketMQTemplate.asyncSend(topic, "payload", new SendCallback() {
+                @Override public void onSuccess(SendResult sendResult) {
+
+                }
+
+                @Override public void onException(Throwable e) {
+
+                }
+            });
+        } catch (MessagingException e) {
+            
assertThat(e).hasMessageContaining("org.apache.rocketmq.remoting.exception.RemotingConnectException:
 connect to [127.0.0.1:9876] failed");
+        }
+    }
+

Review comment:
       In this unit test, a custom thread pool in 133 line is used to send 
messages asynchronously




----------------------------------------------------------------
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:
[email protected]


Reply via email to