apache / incubator-seata

:fire: Seata is an easy-to-use, high-performance, open source distributed transaction solution.
https://seata.apache.org/
Apache License 2.0
25.23k stars 8.76k forks source link

可否增加 Solon 框架的支持?加个模块:seata-solon-plugin #5614

Open noear opened 1 year ago

noear commented 1 year ago

Solon 框架的仓库:

https://github.com/noear/solon

slievrly commented 1 year ago

I understand that a viable solution would be to add a filter on the Solon framework side to pass through the context related to Seata transactions, right?

funky-eyes commented 1 year ago

目前2.x分支尚未发布,在1.x上tcc是强依赖与spring的,xa与at依赖数据源代理与spring是解耦的,包括TM侧也是与spring解耦的,我认为只要传递了xid,并在solon中将其绑定到业务线程的上下文中即可,如果solon要集成自动创建事务决议事务的功能,这块需要增加一些切面+注解功能,这块在2.x上对接应该相对容易,我们在2.x中将其与spring彻底解耦,对接也比较容易,只要其框架有扩展点使我们将业务的bean进行代理问题应该不大

noear commented 1 year ago

I understand that a viable solution would be to add a filter on the Solon framework side to pass through the context related to Seata transactions, right?

是的。就是这个意思:)

noear commented 1 year ago

目前2.x分支尚未发布,在1.x上tcc是强依赖与spring的,xa与at依赖数据源代理与spring是解耦的,包括TM侧也是与spring解耦的,我认为只要传递了xid,并在solon中将其绑定到业务线程的上下文中即可,如果solon要集成自动创建事务决议事务的功能,这块需要增加一些切面+注解功能,这块在2.x上对接应该相对容易,我们在2.x中将其与spring彻底解耦,对接也比较容易,只要其框架有扩展点使我们将业务的bean进行代理问题应该不大

我觉得应该是的:与 spring 解耦,就可以与各种生态框架进行适配了:)

slievrly commented 1 year ago

@noear You can submit a PR to adapt Solon.

noear commented 1 year ago

@noear You can submit a PR to adapt Solon.

@slievrly 上面的老兄不是说,现在 1.x 有些内容强依赖于 spring ,需要等 2.x 解耦吗???解耦后,我一起参与适配:)

noear commented 1 year ago

不知 2.x ,计划哪日发布?

slievrly commented 1 year ago

@noear 跟Spring没啥关系,你要做的是在服务调用的filter透传和绑定Seata xid就行。参考以下RRC框架的集成,不知道我理解是不是有误。 https://github.com/seata/seata/tree/develop/integration

noear commented 1 year ago

@slievrly 上面的老兄说现在的 1.x 与 spring 有强耦?。。。我晚点研究下。

noear commented 1 year ago

@slievrly 另外请教下,提交 pr 的话。。。我可否使用中文注释?

funky-eyes commented 1 year ago

@slievrly 上面的老兄说现在的 1.x 与 spring 有强耦?。。。我晚点研究下。

tcc和saga有,xa和at没有

noear commented 1 year ago

@a364176773 v2.x 啥时候发啊?它是不是与 spring 解耦啦???

noear commented 1 year ago

我发现这个 issue ,越来越掉下面了:)。。。你们,还记得这事的吧:)

funky-eyes commented 1 year ago

@a364176773 v2.x 啥时候发啊?它是不是与 spring 解耦啦???

你可以基于2.x开发,at和xa,我不知道你们那边有没有想spring-boot一样对datasource自动装配,如果有的话,还需要配置个自动代理,将这个bean对外暴露的时候转成datasourceproxy,如果是xa就是datasourceproxyxa,短时间来看,你可以直接先传递xid,他们直接手动用datasourceproxy去操作业务sql是没问题的,后面再逐步完善,事务切面代理之类的

noear commented 1 year ago

@a364176773 2.x 已经有了是吧?。。。Solon 的源数据,倒是由用户构建的(理念上,是以多数据源驱动的。所以用户建,用户命名):

//配置数据源
@Configuration
public class Config {
    //typed=true,表示默认数据源。@Db 可不带名字注入 
    @Bean(name = "db1", typed = true)
    public DataSource db1(@Inject("${demo.db1}") HikariDataSource ds) {
        return ds;
    }
}

不过 solon 有自己的本地 jdbc 事务管理(包括注解与手动,两种模式)

noear commented 1 year ago

以往我适配的经验是:找那个框架的 springboot 适配版,然后改一下就差不多了。。。。但是, seata 的 springboot 适配版本引入了 “seata-all”,而 "seata-all" 里引入了 “seata-spring”。。。

那 solon 应该引入什么? @a364176773