From 26a54553eb2e4dd999f7dea7093fedcb589da68f Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Thu, 8 Dec 2016 18:06:03 +0800 Subject: [PATCH] update --- .../src/main/java/com/zheng/cms/web/jms/MessageListener.java | 5 +++-- .../src/main/resources/applicationContext-activemq.xml | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/MessageListener.java b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/MessageListener.java index 07864f29..b9161be5 100644 --- a/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/MessageListener.java +++ b/zheng-cms/zheng-cms-web/src/main/java/com/zheng/cms/web/jms/MessageListener.java @@ -12,6 +12,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Component; import javax.jms.Message; +import javax.jms.Session; import javax.jms.TextMessage; import java.text.SimpleDateFormat; import java.util.Date; @@ -30,8 +31,8 @@ public class MessageListener extends MessageListenerAdapter { @Autowired UserService userService; - @JmsListener(containerFactory = "connectionFactory", destination = "defaultQueueDestination") - public void processOrder(final Message message) { + @JmsListener(destination="defaultQueueDestination",concurrency="5-10") + public void processOrder(final Message message, Session session) { // 使用线程池多线程处理 threadPoolTaskExecutor.execute(new Runnable() { public void run() { diff --git a/zheng-cms/zheng-cms-web/src/main/resources/applicationContext-activemq.xml b/zheng-cms/zheng-cms-web/src/main/resources/applicationContext-activemq.xml index c8e4a048..e9bc01d2 100644 --- a/zheng-cms/zheng-cms-web/src/main/resources/applicationContext-activemq.xml +++ b/zheng-cms/zheng-cms-web/src/main/resources/applicationContext-activemq.xml @@ -48,6 +48,10 @@ + + + + \ No newline at end of file