Skip to content

Commit fc6079f

Browse files
committed
添加 motan rpc框架支持
1 parent 435ec41 commit fc6079f

1 file changed

Lines changed: 98 additions & 37 deletions

File tree

README.md

Lines changed: 98 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,116 @@
1-
# LCN分布式事务框架
1+
# LCN分布式事务框架v4.0
22

33
"LCN并不生产事务,LCN只是本地事务的搬用工"
44

5+
## 官方网址
56

6-
## maven 包
7+
[www.txlcn.org](http://www.txlcn.org)
78

89

10+
## 框架特点
11+
12+
1. 支持各种基于spring的db框架
13+
2. 兼容SpringCloud、Dubbo、motan
14+
3. 使用简单,低依赖,代码完全开源
15+
4. 基于切面的强一致性事务框架
16+
5. 高可用,模块可以依赖Dubbo或SpringCloud的集群方式做集群化,TxManager也可以做集群化
17+
6. 支持本地事务和分布式事务共存
18+
7. 支持事务补偿机制,增加事务补偿决策提醒
19+
8. 增加插件拓展机制
20+
21+
22+
## 原理介绍
23+
24+
[原理介绍](https://github.com/codingapi/tx-lcn/wiki) [视频讲解](http://www.txlcn.org/v4/index.html)
25+
26+
## 目录说明
27+
28+
transaction-dubbo LCN dubbo rpc框架扩展支持
29+
30+
transaction-springcloud LCN springcloud rpc框架扩展支持
31+
32+
transaction-motan LCN motan rpc框架扩展支持
33+
34+
tx-client 是LCN核心tx模块端控制框架
35+
36+
tx-manager 是LCN 分布式事务协调器
37+
38+
tx-plugins-db 是LCN 对关系型数据库的插件支持
39+
40+
tx-plugins-nodb 是LCN 对于无数据库模块的插件支持
41+
42+
tx-plugins-redis 是LCN 对于redis模块的插件支持(功能暂未实现)
43+
44+
45+
## 使用说明
46+
47+
分布式事务发起方:
48+
49+
```
50+
51+
@Override
52+
@TxTransaction
53+
@Transactional
54+
public boolean hello() {
55+
//本地调用
56+
testDao.save();
57+
//远程调用方
58+
boolean res = test2Service.test();
59+
//模拟异常
60+
int v = 100/0;
61+
return true;
62+
}
63+
64+
65+
```
66+
67+
分布式事务被调用方(test2Service的业务实现类)
968
```
1069
11-
<dependency>
12-
<groupId>com.codingapi</groupId>
13-
<artifactId>tx-client</artifactId>
14-
<version>1.0.0</version>
15-
</dependency>
16-
17-
<dependency>
18-
<groupId>com.codingapi</groupId>
19-
<artifactId>tx-plugins-nodb</artifactId>
20-
<version>1.0.0</version>
21-
</dependency>
22-
23-
<dependency>
24-
<groupId>com.codingapi</groupId>
25-
<artifactId>tx-plugins-db</artifactId>
26-
<version>1.0.0</version>
27-
</dependency>
28-
29-
<dependency>
30-
<groupId>com.codingapi</groupId>
31-
<artifactId>transaction-springcloud</artifactId>
32-
<version>1.0.0</version>
33-
</dependency>
34-
35-
36-
<dependency>
37-
<groupId>com.codingapi</groupId>
38-
<artifactId>transaction-dubbo</artifactId>
39-
<version>1.0.0</version>
40-
</dependency>
70+
@Override
71+
@Transactional
72+
public boolean test() {
73+
//本地调用
74+
testDao.save();
75+
return true;
76+
}
4177
4278
```
4379

44-
## LCN原理介绍
80+
如上代码执行完成以后两个模块都将回滚事务。
4581

46-
[LCN原理](https://github.com/codingapi/tx-lcn/wiki/LCN原理)
82+
说明:在使用LCN分布式事务时,只需要将事务的开始方法添加`@TxTransaction`注解即可。详细见demo教程
83+
84+
## 关于@TxTransaction 使用说明
85+
86+
@TxTransaction注解是分布式事务的标示。
87+
88+
若存在业务方法:a->b b->c b->d,那么开启分布式事务注解的话,只需要在a方法上添加@TxTransaction即可。
89+
90+
```
91+
@TxTransaction
92+
@Transactional
93+
public void a(){
94+
b();
95+
}
96+
97+
public void b(){
98+
c();
99+
d();
100+
}
101+
102+
public void c(){}
103+
104+
public void d(){}
105+
```
47106

107+
## demo演示教程
48108

49-
## LCN demo教程
109+
每个demo下有区分为 jdbc/hibernate/mybatis不同框架的版本demo
50110

51-
[springcloud版本demo](https://github.com/codingapi/springcloud-lcn-demo)
111+
[springcloud版本](https://github.com/codingapi/springcloud-lcn-demo)
52112

113+
[dubbo版本](https://github.com/codingapi/dubbo-lcn-demo)
53114

54-
[dubbo版本demo](https://github.com/codingapi/dubbo-lcn-demo)
55115

116+
技术交流群:554855843

0 commit comments

Comments
 (0)