Spring MQQueueConnectionFactory和MQXAQueueConnectionFactory之间的差异
如果我只想在Spring Boot中通过@JmsListener读取消息,有人能解释我应该使用MQXAQueueConnectionFactory吗 我使用MQXAQueueConnectionFactory和MQQueueConnectionFactory读取消息,但看不出有什么区别。若我在listener方法中出现异常,我会看到消息一次又一次地被传递 此时,对于DefaultJmsListenerContainerFactory,SetSessionTransact设置为true,setTransactionManager设置为null:Spring MQQueueConnectionFactory和MQXAQueueConnectionFactory之间的差异,spring,spring-boot,jms,ibm-mq,spring-jms,Spring,Spring Boot,Jms,Ibm Mq,Spring Jms,如果我只想在Spring Boot中通过@JmsListener读取消息,有人能解释我应该使用MQXAQueueConnectionFactory吗 我使用MQXAQueueConnectionFactory和MQQueueConnectionFactory读取消息,但看不出有什么区别。若我在listener方法中出现异常,我会看到消息一次又一次地被传递 此时,对于DefaultJmsListenerContainerFactory,SetSessionTransact设置为true,setTr
public void configure(DefaultJmsListenerContainerFactory factory,
ConnectionFactory connectionFactory) {
Assert.notNull(factory, "Factory must not be null");
Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
factory.setConnectionFactory(connectionFactory);
factory.setPubSubDomain(this.jmsProperties.isPubSubDomain());
if (this.transactionManager != null) {
factory.setTransactionManager(this.transactionManager); // null
}
else {
factory.setSessionTransacted(true);
}
...
顾名思义,
MQXAQueueConnectionFactory
用于处理XA事务。从技术上讲,MQXAQueueConnectionFactory
实现了最终提供对其他与XA相关的、和接口的访问。通常,底层框架(如JavaEE或Spring)将使用这些工具和事务管理器来协调多个资源管理器(如JMS提供程序和JDBC数据库)之间的XA事务
因为您不使用XA事务,所以应该只使用MQQueueConnectionFactory
需要明确的是,XA事务不同于事务化JMS会话(这是您所配置的)