I am trying to use XA Connection of Apache ActiveMQ Artemis for JMS with Spring Boot. My relevant config looks like this:
spring:
artemis:
host: localhost
mode: native
jta:
bitronix:
tm:
serverId: spring-btm
timer:
defaultTransactionTimeout: 100
connectionfactory:
user: jmsuser
password: password
allow-local-transactions: true
class-name: org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory
But this is producing continuous errors in the log which says:
o.s.t.jta.JtaTransactionManager - Using JTA TransactionManager: a BitronixTransactionManager with 0 in-flight transaction(s)
WARN bitronix.tm.twopc.Preparer - executing transaction with 0 enlisted resource
The "executing transaction with 0 enlisted resource" keeps getting printed every 3 milliseconds. How do we get the BTM JTA provider to "see" that it should use the Artemis resource? I have had MySQL based spring boot application working without much fuss but Artemis does not work.
I've eventually figured it out. The trick is to use the Spring Boot's JTA wrapper with XAConnectionFactoryWrapper as:
That solved the issue of the resource not being enlisted in the JTA transaction.