-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Tcc模式是否支持动态数据源,如果不支持能否给个解决思路 #6731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
如果出现retry client侧应该有日志,请把你的示例代码和,client侧的日志提交上来 |
一个比较简单的方案,如果你是spring的应用 A straightforward approach, if you are using a Spring application:
For applications not using Spring, you can also extend this API by independently extending a |
我看到SpringFenceHandler是2.0版本的,我用的是1.7.1,用TCCFenceHandler可以么, |
1.7.1版本,我是每次都要TCCFenceHandler.setDataSource()和TCCFenceHandler.setTransactionTemplate()么 |
|
首先你自己创建一个TCCFenceHandler的子类的bean,seata侧就不会再构建TCCFenceHandler的bean,所以注入的是你的TCCFenceHandler,因为TCCFenceHandler是通过spring的DataSourceUtils获取的connection,只要你在这个之前,通过actionname能判断出来这个接口需要哪个数据源,或者通过commitMethod方法上的注解切换这个线程下的动态数据源的主数据源为哪个datasource就可以了,所以不需要每次都进行set之类的。 |
OK,明白了,感谢 |
Ⅰ. Issue Description
使用动态数据源,TCC模式下,一直Retry无法提交,
如何不切换数据源,代码是没问题的
Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
The text was updated successfully, but these errors were encountered: