Skip to content
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

Wc #561

Open
wants to merge 77 commits into
base: dev6.0
Choose a base branch
from
Open

Wc #561

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ed2956d
springcloud2.0.4
yizhishang Nov 28, 2018
a92e2db
修改tx-manager版本号
yizhishang Nov 28, 2018
a974dbb
修改tx-manager版本号
yizhishang Nov 28, 2018
05f36be
删除多余的文件:dubbo和motan
yizhishang Nov 28, 2018
48c605f
删除多余的文件:dubbo和motan
yizhishang Nov 28, 2018
b6dc20e
删除多余的文件:dubbo和motan
yizhishang Nov 28, 2018
04bfa6c
删除多余的文件:dubbo和motan
yizhishang Nov 28, 2018
604ec59
删除多余的文件:dubbo和motan
yizhishang Nov 28, 2018
3aeda54
tx-manager/index.html
yizhishang Nov 29, 2018
fefb1c8
tx-manager/index.html
yizhishang Nov 30, 2018
b4c6bd0
add two demo
yizhishang Nov 30, 2018
42611b2
add two demo
yizhishang Nov 30, 2018
a59fe9c
add two demo
yizhishang Nov 30, 2018
9110ded
添加注释
yizhishang Nov 30, 2018
67fc180
添加注释
yizhishang Nov 30, 2018
52a9864
format
yizhishang Dec 3, 2018
ab67d57
format
yizhishang Dec 3, 2018
86fb974
format
yizhishang Dec 3, 2018
be0e64c
add log for compensate
yizhishang Dec 3, 2018
7ee6966
修改demo2方法,添加参数(id, name)
yizhishang Dec 3, 2018
e1f83a9
add markdown for demo
yizhishang Dec 3, 2018
02ecbad
提示优化
yizhishang Dec 3, 2018
166cd46
添加注释
yizhishang Dec 3, 2018
055c67d
tx-manager 升级到2.0.4版本
yizhishang Dec 3, 2018
b404a29
tx-manager 升级到2.0.4版本
yizhishang Dec 3, 2018
caecf11
format
yizhishang Dec 3, 2018
02b2d8f
format
yizhishang Dec 3, 2018
beda82f
tx-manager 升级到2.0.4版本
yizhishang Dec 3, 2018
877da02
添加RestTemplate 拦截器设置
yizhishang Dec 4, 2018
14847ef
format
yizhishang Dec 4, 2018
cbff588
调整pom结构
yizhishang Dec 4, 2018
da3b66c
格式化代码
yizhishang Dec 5, 2018
62f6532
notifyResult请求方式修改成post
yizhishang Dec 5, 2018
a215cf8
tx-manager添加日志
yizhishang Dec 5, 2018
abd6f67
添加ribbon超时配置
yizhishang Dec 5, 2018
a3742be
tx-client引入ribbon 依赖包
yizhishang Dec 5, 2018
dfdc70b
为满足tx-manager集群:使用feign方式请求
yizhishang Dec 5, 2018
9292748
为满足tx-manager集群:使用feign方式请求
yizhishang Dec 6, 2018
a29242b
添加日志
yizhishang Dec 6, 2018
2b1c666
改造部分代码
yizhishang Dec 6, 2018
19c44bb
改造成服务发现后,删除冗余的代码
yizhishang Dec 6, 2018
0a271ed
maven中删除javadoc的插件
yizhishang Dec 6, 2018
457f1ab
将feign移植到tx-client中,保持和demo中的一样的包结构,这样才能扫描到
yizhishang Dec 6, 2018
4c540fe
编写demo引用文档
yizhishang Dec 6, 2018
50ef629
编写demo引用文档
yizhishang Dec 6, 2018
de732b7
demo中去掉pom.xml 中web包含的tomcat的引用,使用undertow
yizhishang Dec 6, 2018
189a515
修改Ribbon负载均衡策略
yizhishang Dec 7, 2018
064768e
修改Ribbon负载均衡策略
yizhishang Dec 10, 2018
df629ca
整理版本
yizhishang Dec 10, 2018
5326cfe
整理版本
yizhishang Dec 10, 2018
234280a
整理版本,添加注释说明
yizhishang Dec 10, 2018
01ff832
整理版本,添加注释说明
yizhishang Dec 10, 2018
fbe7749
整理版本,添加注释说明
yizhishang Dec 11, 2018
6694ed9
整理版本,添加注释说明
yizhishang Dec 11, 2018
5bd16cc
整理版本,添加注释说明
yizhishang Dec 11, 2018
1586f80
整理版本,添加注释说明
yizhishang Dec 11, 2018
372a3c2
整理版本,添加注释说明
yizhishang Dec 11, 2018
1ed77e9
整理版本,添加注释说明
yizhishang Dec 11, 2018
aaaddee
整理版本,添加注释说明:删除extensions
yizhishang Dec 12, 2018
0f1722f
整理版本,添加注释说明
yizhishang Dec 12, 2018
0f75138
输出日志:补偿数据
yizhishang Dec 12, 2018
8101889
输出日志:删除冗余代码
yizhishang Dec 13, 2018
8ce941b
输出日志:删除冗余代码
yizhishang Dec 13, 2018
c403edf
输出日志:删除冗余代码
yizhishang Dec 13, 2018
20a3ea1
tx-manager:调整redis单节点配置
yizhishang Dec 15, 2018
5b3c790
增加节点demo3
yizhishang Dec 15, 2018
445e6b0
增加节点demo3
yizhishang Dec 15, 2018
42e126e
--
yizhishang Dec 17, 2018
ad100ad
--
yizhishang Dec 17, 2018
23c7fe0
--
yizhishang Dec 17, 2018
bcf995b
Update README.md
xlorne Dec 31, 2018
b2da155
Merge branch '4.1.0-springboot2.0.x' into springcloud-2.0.4
xlorne Dec 31, 2018
3759576
Merge pull request #169 from yizhishang/springcloud-2.0.4
xlorne Dec 31, 2018
4c5b6c2
init
wangchao550586585 Nov 27, 2020
9d0c396
init
wangchao550586585 Nov 28, 2020
2549c42
init
wangchao550586585 Dec 12, 2020
1577cff
增加注释
wangchao550586585 Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 5 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LCN分布式事务框架v4.0
# LCN分布式事务框架v4.0 for springboot2.0.x

"LCN并不生产事务,LCN只是本地事务的协调者"

Expand Down Expand Up @@ -30,11 +30,11 @@

## 目录说明

transaction-dubbo LCN dubbo rpc框架扩展支持
extensions feign扩展配置类

transaction-springcloud LCN springcloud rpc框架扩展支持
springcloud-lcn-demo demo案例

transaction-motan LCN motan rpc框架扩展支持
transaction-springcloud LCN springcloud rpc框架扩展支持

tx-client 是LCN核心tx模块端控制框架

Expand All @@ -48,7 +48,6 @@ tx-plugins-db 是LCN 对关系型数据库的插件支持
分布式事务发起方:

```

@Override
@TxTransaction(isStart=true)
@Transactional
Expand All @@ -61,13 +60,10 @@ tx-plugins-db 是LCN 对关系型数据库的插件支持
int v = 100/0;
return true;
}


```

分布式事务被调用方(test2Service的业务实现类)
```

@Override
@Transactional
@TxTransaction
Expand All @@ -76,7 +72,6 @@ tx-plugins-db 是LCN 对关系型数据库的插件支持
testDao.save();
return true;
}

```

如上代码执行完成以后两个模块都将回滚事务。
Expand Down Expand Up @@ -119,27 +114,12 @@ tx-plugins-db 是LCN 对关系型数据库的插件支持
<version>${lcn.last.version}</version>
</dependency>


<dependency>
<groupId>com.codingapi</groupId>
<artifactId>tx-plugins-db</artifactId>
<version>${lcn.last.version}</version>
</dependency>


<dependency>
<groupId>com.codingapi</groupId>
<artifactId>transaction-dubbo</artifactId>
<version>${lcn.last.version}</version>
</dependency>

<dependency>
<groupId>com.codingapi</groupId>
<artifactId>transaction-motan</artifactId>
<version>${lcn.last.version}</version>
</dependency>


<dependency>
<groupId>com.codingapi</groupId>
<artifactId>transaction-springcloud</artifactId>
Expand All @@ -148,19 +128,6 @@ tx-plugins-db 是LCN 对关系型数据库的插件支持

```

依赖gradle等形式,见中心库

[http://mvnrepository.com/search?q=codingapi](http://mvnrepository.com/search?q=codingapi)


## demo演示教程

每个demo下有区分为 jdbc/hibernate/mybatis不同框架的版本demo

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

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

[motan版本](https://gitee.com/zfvipCase/motan-lcn-demo)

技术交流群:554855843
[springcloud版本](https://github.com/yizhishang/tx-lcn/tree/springcloud-2.0.4/springcloud-lcn-demo)
97 changes: 18 additions & 79 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.codingapi</groupId>
<artifactId>tx-lcn</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.0</version>
<packaging>pom</packaging>

<name>tx-lcn</name>
Expand All @@ -16,64 +16,35 @@
<module>tx-client</module>
<module>tx-manager</module>

<module>transaction-dubbo</module>
<module>transaction-springcloud</module>
<module>transaction-motan</module>

<module>tx-plugins-db</module>

<module>springcloud-lcn-demo</module>
<module>tx-eruka</module>
</modules>

<properties>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compile.source>1.7</maven.compile.source>
<maven.compile.target>1.7</maven.compile.target>
<java.version>1.7</java.version>
<maven.compile.source>1.8</maven.compile.source>
<maven.compile.target>1.8</maven.compile.target>
<java.version>1.8</java.version>
<maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>

<lcn.last.version>4.2.0-SNAPSHOT</lcn.last.version>
</properties>



<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<developers>
<developer>
<name>lorne</name>
<email>1991wangliang@gmail.com</email>
<roles>
<role>developer</role>
</roles>
<timezone>+8</timezone>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/codingapi/tx-lcn.git</connection>
<developerConnection>scm:git:https://github.com/codingapi/tx-lcn.git</developerConnection>
<url>https://github.com/codingapi/tx-lcn</url>
<tag>v${project.version}</tag>
</scm>

<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Maven Central Staging Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<org.aspectj.version>1.8.4</org.aspectj.version>
<guava.version>19.0</guava.version>
<hessian.version>4.0.38</hessian.version>
<protostuff.version>1.1.3</protostuff.version>
<kryo.version>4.0.0</kryo.version>
<org.slf4j-version>1.7.7</org.slf4j-version>

<lcn.last.version>4.2.0</lcn.last.version>
<spring-cloud.version>2.0.4.RELEASE</spring-cloud.version>
<org.springframework-version>5.0.8.RELEASE</org.springframework-version>

<spring-cloud-starter-openfeign.version>2.0.0.RELEASE</spring-cloud-starter-openfeign.version>
</properties>

<build>
<plugins>
Expand Down Expand Up @@ -101,7 +72,6 @@
</executions>
</plugin>


<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
Expand All @@ -113,37 +83,6 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<!--手动打包时,将下面的plugin注释掉-->

<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-gpg-plugin</artifactId>-->
<!--<version>1.6</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>sign-artifacts</id>-->
<!--<phase>verify</phase>-->
<!--<goals>-->
<!--<goal>sign</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->

</plugins>
</build>

Expand Down
41 changes: 41 additions & 0 deletions springcloud-lcn-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
>1.maven引入
````xml
<dependency>
<groupId>com.codingapi</groupId>
<artifactId>transaction-springcloud</artifactId>
<version>${lcn.last.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.codingapi</groupId>
<artifactId>tx-plugins-db</artifactId>
<version>${lcn.last.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
````

>2.application.properties文件配置eureka地址
```properties
eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
```

>3.发起方和参与方的业务方法添加@Transactional注解和@TxTransaction注解

>4.发起方中的涉及分布式事务的方法要添加@TxTransaction(isStart = true)注解

>5.tx-manager启动前要配置redis

>6.springboot启动类添加注解配置@EnableFeignClients(basePackages = {"com.codingapi.tx"})


注意事项:避免事务发起方和调用方操作一张表的数据,会导致锁表
Loading