ShardingSphere provides three modes for distributed transactions LOCAL, XA, BASE.
transaction:
defaultType: # Transaction mode, optional value LOCAL/XA/BASE
providerType: # Specific implementation of the mode
Configure the JDBC YAML file as follows:
transaction:
defaultType: LOCAL
Configure the JDBC YAML file as follows. providerType must be set to the SPI type of a single XA provider.
To use Narayana:
transaction:
defaultType: XA
providerType: Narayana
To use Atomikos:
transaction:
defaultType: XA
providerType: Atomikos
When using Narayana, add org.apache.shardingsphere:shardingsphere-transaction-xa-narayana and its dependencies. When adding JARs manually, this includes:
jta-5.12.7.Final.jar
arjuna-5.12.7.Final.jar
common-5.12.7.Final.jar
jboss-connector-api_1.7_spec-1.0.0.Final.jar
jboss-logging-3.2.1.Final.jar
jboss-transaction-api_1.2_spec-1.0.0.Alpha3.jar
jboss-transaction-spi-7.6.1.Final.jar
narayana-jts-integration-5.12.7.Final.jar
shardingsphere-transaction-xa-narayana-x.x.x-SNAPSHOT.jar
Configure the JDBC YAML file as follows:
transaction:
defaultType: BASE
providerType: Seata
Build a Seata Server, add relevant configuration files and Seata dependencies, see ShardingSphere Integrates Seata Flexible Transactions
