参考网址:https://www.txlcn.org/en-us/docs/demo/dubbo.html
目的:用户多个模块之间的事务的管理,保持数据的一致性
联通实验室测试
1.启动redis 192.168.100.2服务器上面的 /usr/local/
2.启动 txlcn-tm 192.168.100.2服务器,端口http://192.168.100.2:7970 密码codingapi
注意:
1.打包命令:mvn clean package -Dmaven.test.skip=true
2.jar报没有main函数,pom.xml加上
<!--解决SpringBoot打包成jar后运行提示没有主清单属性-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.codingapi.txlcn.tm.TMApplication</mainClass>
<!--<includeSystemScope>true</includeSystemScope>-->
</configuration>
</plugin>
3数据处理模块的application.yml中配置 tx-client注册信息
tx-lcn:
client:
#manager-address:127.0.0.1:8070
manager-address:192.168.100.2:8070
开始运行配置上加注解:@EnableDistributedTransaction
在调用方法上加上注解:@LcnTransaction
4.在被调用的模块的开始运行配置上加注解:@EnableDistributedTransaction
在被调用的模块的方法上加上注解:@TxTransaction
来源:CSDN
作者:weixin_41630573
链接:https://blog.csdn.net/weixin_41630573/article/details/103240640