0

I have a spring boot application using generic maven components - one for IBM MQ configuration and the other for database configuration. Both these maven components were developed by us.
We need to setup XA transaction in this application to ensure that input MQ messages coming into the application via IBM MQ and then persists the message to Database.
We are planning to use Atomikos transaction manager.
My query is - Do we need separate transaction manager configured i.e. one each for JDBC and MQ (JMS) here?

1 Answers1

0

You can use the standard machinery to deal with distributed (or local) transactions but you need configure some transaction manager.

If you use Java enterprise services, the use of transaction for JMS are described (e.g.) here, here and here (typically the @Transactional annotation).

If not, for spring boot you can configure, without special coding (i.e. using again @Transactional), the atomikos transaction manager as described here. Basically:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jta-atomikos</artifactId>
</dependency>
josejuan
  • 9,338
  • 24
  • 31
  • In one application/module, do we need to configure two different transaction managers - one for JMS and the other for JDBC - or we need just one transaction manager configured for both JMS and JDBC? – Mitesh Parikh Aug 18 '21 at 07:33
  • Only one if not, both should be synchonized. – josejuan Aug 18 '21 at 07:34