在《实现应用内分布式事务管理(生产者)》章节其实已经对JmsTemplate进行了重新注册,在源码JmsAutoConfiguration可以看到如下代码设置:
jmsTemplate.setPubSubDomain(this.properties.isPubSubDomain());
其主要设置我们的jmsTemplate是队列还是发布订阅类型消息,isPubSubDomain可以在application.preperties中配置spring.jms.pub-sub-domain,默认其为false即我队列模式。
本章概要:
1、定义两个jmsTemplate,一个队列一个订阅发布类型;
2、定义两个JmsMessagingTemplate,一个队列一个订阅发布类型;
3、分布式事务验证;
定义两个jmsTemplate
package com.shf.activemq.config;
import javax.jms.DeliveryMode;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jms.JmsProperties;
import