Comments (1)
@fuzhq
你好~,第一个问题,可以参考tcc-transaction-dubbo-order项目里的配置,在appcontext-service-datasource.xml中:
<bean id="orderDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" lazy-init="false">
<property name="driverClass" value="#{jdbc['jdbc.driverClassName']}"/>
<property name="jdbcUrl" value="#{jdbc['jdbc.url']}"/>
<property name="user" value="#{jdbc['jdbc.username']}"/>
<property name="password" value="#{jdbc['jdbc.password']}"/>
<property name="initialPoolSize" value="#{jdbc['c3p0.initialPoolSize']}"/>
<property name="minPoolSize" value="#{jdbc['c3p0.minPoolSize']}"/>
<property name="maxPoolSize" value="#{jdbc['c3p0.maxPoolSize']}"/>
<property name="acquireIncrement" value="#{jdbc['c3p0.acquireIncrement']}"/>
<property name="maxIdleTime" value="#{jdbc['c3p0.maxIdleTime']}"/>
<property name="checkoutTimeout" value="#{jdbc['c3p0.checkoutTimeout']}"/>
</bean>
在appcontext-service-dao.xml中:
<bean id="transactionRepository"
class="org.mengyun.tcctransaction.spring.repository.SpringJdbcTransactionRepository">
<property name="dataSource" ref="orderDataSource"/>
</bean>
另外一个问题:FileSystemTransactionRepository 适合事务提供方节点或是事务调用方是单节点场景,RedisTransactionRepository、ZooKeeperTransactionRepository和JdbcTransactionRepository适合事务提供方节点或是事务调用方节点是多个节点场景(集群),在tcc-transaction-unit-test项目里的tcc-transaction-unit-test.xml中有这些repository的配置示例,在运行时只需要配置一个,如下:
<context:component-scan base-package="org.mengyun.tcctransaction.unittest"/>
<bean class="org.mengyun.tcctransaction.spring.recover.DefaultRecoverConfig">
<property name="maxRetryCount" value="30"/>
<property name="recoverDuration" value="5"/>
<property name="cronExpression" value="0/15 * * * * ?"/>
</bean>
<bean id="transactionRepository"
class="org.mengyun.tcctransaction.spring.repository.SpringJdbcTransactionRepository">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://127.0.0.1:3306/test"/>
<property name="username" value="root"/>
<property name="password" value=""/>
</bean>
<!--<bean id="transactionRepository"-->
<!--class="org.mengyun.tcctransaction.repository.ZooKeeperTransactionRepository">-->
<!--<!–<property name="zkServers" value="localhost:2181,localhost:2183,localhost:2185"/>–>-->
<!--<property name="zkServers" value="localhost:2181"/>-->
<!--<property name="zkTimeout" value="10000"/>-->
<!--<property name="zkRootPath" value="/tcc_ut"/>-->
<!--</bean>-->
<!--recommanded way; to use this, make sure redis is safely durable,which means need set redis as AOF mode and always fsync.
appendonly yes
appendfsync always
-->
<!--<bean id="transactionRepository" class="org.mengyun.tcctransaction.repository.RedisTransactionRepository">-->
<!--<property name="keyPrefix" value="tcc_ut_"/>-->
<!--<property name="jedisPool" ref="jedisPool"/>-->
<!--</bean>-->
<!--<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">-->
<!--<property name="maxTotal" value="1000"/>-->
<!--<property name="maxWaitMillis" value="1000"/>-->
<!--</bean>-->
<!--<bean id="jedisPool" class="redis.clients.jedis.JedisPool">-->
<!--<constructor-arg index="0" ref="jedisPoolConfig"/>-->
<!--<constructor-arg index="1" value="127.0.0.1"/>-->
<!--<constructor-arg index="2" value="6379" type="int"/>-->
<!--<constructor-arg index="3" value="1000" type="int"/>-->
<!--<!–<constructor-arg index="4" value="${redis.password}"/>–>-->
<!--</bean>-->
<!--<bean id="transactionRepository" class="org.mengyun.tcctransaction.repository.FileSystemTransactionRepository">-->
<!--<property name="rootPath" value="/data/tcc"/>-->
<!--</bean>-->
from tcc-transaction.
Related Issues (20)
- tcc-transaction没看到有与springboot和springcloud生态整合的说明,是不支持吗? HOT 2
- tcc版本1.2.12,duobbo版本2.7.0,主事务到分支事务xid传参错误问题 HOT 6
- 红包金额表和红包订单表都在一个数据库里面,为什么要用分布式事务呢?直接用 spring 支持的@transactional 不行吗? HOT 2
- tcc-http-sample 样例演示购买超链接 抛异常 java.net.SocketTimeoutException: Read timed out HOT 1
- why TradeOrderServiceProxy.record need @Compensable ? HOT 1
- sample中dubbo方式数据库问题 HOT 1
- tcc-transaction分布式事务管理器操作文档 HOT 1
- 如何避免tcc try阶段业务并发重复调用 HOT 2
- 是否支持防悬挂控制 HOT 4
- tcc-transaction 与Dubbo整合后,三层事务方法,底层服务无法confirm或cancel的问题 HOT 3
- 无,看错
- 作者牛逼 HOT 1
- 谁在使用tcc-transaction HOT 1
- 请问如何防止脏读和脏写? HOT 1
- 客户端无法注册naocs HOT 1
- Dependency org.yaml:snakeyaml, leading to CVE problem HOT 1
- JdbcTransactionStorage 关键字 DOMAIN HOT 1
- 框架调用从业务补偿方法时spring注入类丢失问题 HOT 6
- tcc-transaction-server找不到下载地址 HOT 1
- 不支持dubbo3提供的triple协议(grpc)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcc-transaction.