LCN分布式事务使用

*爱你&永不变心* 提交于 2019-11-26 07:30:46

参考网址: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

 

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!