Search code examples
springjpauniqueatomikos

Atomikos - Unique resource names


We have a Java micro service project using spring boot and want to know if the following properties must be unique across the servers in the cluster as per the blog post https://fogbugz.atomikos.com/default81d0.html?community.6.2225.7

App is based on

Spring Boot - 1.5.12.RELEASE
Spring - 4.3.16.RELEASE
Jersey - 2.25.1
Active MQ - 5.14.5
Atomikos - 3.9.3
RedHat Java - 1.8.0_191

The functionality includes JDBC, JPA and JMS

Sample Server names: node1, node2, node3

If the properties below are the same on all servers like shown below, then I believe it will cause issues with transaction recovery and other possible XID issues, correct?

com.atomikos.icatch.tm_unique_name = myapp-tm-node
spring.jta.atomikos.datasource.unique-resource-name = myapp-db-node
spring.jta.atomikos.connectionfactory.unique-resource-name = myapp-jms-node

So technically the values of the above properties should be unique on each node like shown below, correct?

com.atomikos.icatch.tm_unique_name = myapp-tm-node1
spring.jta.atomikos.datasource.unique-resource-name = myapp-db-node1
spring.jta.atomikos.connectionfactory.unique-resource-name = myapp-jms-node1

Likewise the property values ending with "node2" and "node3" on the other two servers

Solution

  • The you don't have to care about the name because you have one Transaction Manger per node.

    Only if the Atomikos transaction manager is shared every party that uses it needs a unique id.