Bitronix Transaction

background

Apache ShardingSphere provides XA transactions that integrate with the Bitronix implementation.

Prerequisites

Introducing Maven dependency

  1. <properties>
  2. <btm.version>2.1.3</btm.version>
  3. </properties>
  4. <dependency>
  5. <groupId>org.apache.shardingsphere</groupId>
  6. <artifactId>shardingsphere-jdbc-core</artifactId>
  7. <version>${shardingsphere.version}</version>
  8. </dependency>
  9. <!-- This module is required when using XA transactions -->
  10. <dependency>
  11. <groupId>org.apache.shardingsphere</groupId>
  12. <artifactId>shardingsphere-transaction-xa-core</artifactId>
  13. <version>${shardingsphere.version}</version>
  14. </dependency>
  15. <dependency>
  16. <groupId>org.apache.shardingsphere</groupId>
  17. <artifactId>shardingsphere-transaction-xa-bitronix</artifactId>
  18. <version>${shardingsphere.version}</version>
  19. </dependency>
  20. <dependency>
  21. <groupId>org.codehaus.btm</groupId>
  22. <artifactId>btm</artifactId>
  23. <version>${btm.version}</version>
  24. </dependency>

Procedure

  1. Configure the XA transaction type
  2. Configure Bitronix

Sample

Configure the XA transaction type

Yaml:

  1. - !TRANSACTION
  2. defaultType: XA
  3. providerType: Bitronix

Configure Bitronix (Deletable)

See Bitronix’s Official Documentation for more details.