Bitronix Transaction
background
Apache ShardingSphere provides XA transactions that integrate with the Bitronix implementation.
Prerequisites
Introducing Maven dependency
<properties>
<btm.version>2.1.3</btm.version>
</properties>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<!-- This module is required when using XA transactions -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-transaction-xa-core</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-transaction-xa-bitronix</artifactId>
<version>${shardingsphere.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.btm</groupId>
<artifactId>btm</artifactId>
<version>${btm.version}</version>
</dependency>
Procedure
- Configure the XA transaction type
- Configure Bitronix
Sample
Configure the XA transaction type
Yaml:
- !TRANSACTION
defaultType: XA
providerType: Bitronix
SpringBoot:
spring:
shardingsphere:
props:
xa-transaction-manager-type: Bitronix
Spring Namespace:
<shardingsphere:data-source id="xxx" data-source-names="xxx" rule-refs="xxx">
<props>
<prop key="xa-transaction-manager-type">Bitronix</prop>
</props>
</shardingsphere:data-source>
Configure Bitronix (Deletable)
See Bitronix’s Official Documentation for more details.
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .