SEATA 分布式事务模式问题

r6vfmomb  于 4个月前  发布在  其他
关注(0)|答案(3)|浏览(77)

Ⅰ. Issue Description

看官方文档,分布式事务支持AT,TCC和SAGA.

我看了seata-sample项目,貌似客户端口项目里面的application.yml文件没有地方指定到底是AT, TCC还是SAGA模式.

我的问题是,是不是在应用RM中用了@LocalTCC就是TCC模式,在应用中用了SAGA状态机器就是SAGA模式?不需要再application.yml里面显式指定分布式事务?

另一方面,我在script/client/spring/application.yml里面看到seata:data-source-proxy-mode: AT. 这个地方是可以指定事务模式吗?

但是我在project\seata-1.6.1\seata-spring-autoconfigure\seata-spring-autoconfigure-client\src\main\resources\META-INF\additional-spring-configuration-metadata.json这个文件里面又只看到支持AT和XA。对应的内容如下:

"hints": [
{
"name": "seata.data-source-proxy-mode",
"values": [
{
"value": "AT",
"description": "the default mode."
},
{
"value": "XA"
}
]
},

麻烦指导一下,如何配置才能使得应用是运行在AT,TCC还是SAGA模式下面?

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

Just paste your stack trace here!

Ⅲ. Describe what you expected to happen

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. xxx
  2. xxx
  3. xxx

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version :
  • Seata version: 1.6
  • OS :
  • Others:
qq24tv8q

qq24tv8q1#

The AT and XA transaction modes are distributed transactions on the data layer, so no additional specification is required at the business layer, but need to add datasource config, the default value is AT.

TCC and Saga are business layer transactions that are independent of data sources and require the configuration of the business layer.

AT和XA事务模式是数据层的分布式事务,所以在业务层不需要额外的指定,但是需要在数据源上配置模式,默认为AT模式。
TCC和Saga是业务层事务与数据源无关,需要业务层的配置。

dxxyhpgq

dxxyhpgq2#

The AT and XA transaction modes are distributed transactions on the data layer, so no additional specification is required at the business layer, but need to add datasource config, the default value is AT.

TCC and Saga are business layer transactions that are independent of data sources and require the configuration of the business layer.

AT和XA事务模式是数据层的分布式事务,所以在业务层不需要额外的指定,但是需要在数据源上配置模式,默认为AT模式。 TCC和Saga是业务层事务与数据源无关,需要业务层的配置。

请问TCC和SAGA业务层如何配置?我在 https://github.com/seata/seata-samples这个项目里面看了dubbo-saga-sample和dubbo-tcc-sample项目。这两个项目里面的file.conf和registry.conf, 这两个文件没有对应的指定TCC和SAGA配置。

在dubbo-tcc-sample代码里面,通过@TwoPhaseBusinessAction,而在dubbo-saga-sample通过引入StateMachineEngine来指定SAGA模式,而不是通过application.yaml 和file.conf和registry.conf来隐式指定TCC和SAGA模式。

我这样理解对吗?@slievrly

ruyhziif

ruyhziif3#

The AT and XA transaction modes are distributed transactions on the data layer, so no additional specification is required at the business layer, but need to add datasource config, the default value is AT.
TCC and Saga are business layer transactions that are independent of data sources and require the configuration of the business layer.
AT和XA事务模式是数据层的分布式事务,所以在业务层不需要额外的指定,但是需要在数据源上配置模式,默认为AT模式。 TCC和Saga是业务层事务与数据源无关,需要业务层的配置。

请问TCC和SAGA业务层如何配置?我在 https://github.com/seata/seata-samples这个项目里面看了dubbo-saga-sample和dubbo-tcc-sample项目。这两个项目里面的file.conf和registry.conf, 这两个文件没有对应的指定TCC和SAGA配置。

在dubbo-tcc-sample代码里面,通过@TwoPhaseBusinessAction,而在dubbo-saga-sample通过引入StateMachineEngine来指定SAGA模式,而不是通过application.yaml 和file.conf和registry.conf来隐式指定TCC和SAGA模式。

我这样理解对吗?@slievrly

Yes, as you said. you can refer to the code of seata-samples .

相关问题