update
This commit is contained in:
parent
a646121b1a
commit
26a54553eb
|
@ -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() {
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
<!--<property name="messageListener" ref="defaultQueueMessageListener"/>-->
|
||||
<!--<!–<property name="concurrency" value="4-10"/>–>-->
|
||||
<!--</bean>-->
|
||||
|
||||
<bean id="jmsListenerContainerFactory" class="org.springframework.jms.config.DefaultJmsListenerContainerFactory">
|
||||
<property name="connectionFactory" ref="connectionFactory"/>
|
||||
</bean>
|
||||
<jms:annotation-driven/>
|
||||
|
||||
</beans>
|
Loading…
Reference in New Issue