package nemo.spring.study.serivce.impl;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import nemo.spring.study.serivce.ExecuteService;
import nemo.spring.study.feign.order.OrderService;
import nemo.spring.study.feign.stock.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* description: 描述.
* <p>
* CreateDate: 2019/6/26/026 19:55<br>
* UpdateUser: Administrator<br>
* UpdateDate: 2019/6/26/026 19:55<br>
* UpdateRemark: 修改内容
* </p>
* <pre>
* {@code
*
* }</pre>
*
* @author Nemo
* @version 1.0
* @since 1.0
*/
@Service
public class ExecuteServiceImpl implements ExecuteService {
@Autowired
private OrderService orderService;
@Autowired
private StockService stockService;
@LcnTransaction
public String execute() {
String orderResult = orderService.addOrder();
String stockResult = stockService.updateStock();
if (!(orderResult.equals("success") && stockResult.equals("success"))){
throw new IllegalStateException("调用库存服务接口失败,开始回退订单事务代码");
}
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
微服务中的分布式事务框架tx-lcn实例,该实例的注册中心为eureka。相关版本, spring-boot-starter-parent : 2.1.4.RELEASE, spring-cloud-dependencies:Greenwich.SR1, txlcn:5.0.2.RELEAS
资源推荐
资源详情
资源评论
收起资源包目录
txlcn-demo.rar (68个子文件)
pom.xml 2KB
server-order
pom.xml 2KB
target
generated-sources
annotations
classes
nemo
spring
study
ServerOrderApp.class 842B
web
OrderController.class 855B
mapper
OrderMapper.class 519B
service
OrderService.class 173B
impl
OrderServiceImpl.class 1KB
entity
OrderEntity.class 2KB
application.properties 1KB
src
test
java
main
resources
application.properties 1KB
java
nemo
spring
study
web
OrderController.java 907B
mapper
OrderMapper.java 782B
service
impl
OrderServiceImpl.java 1KB
OrderService.java 461B
entity
OrderEntity.java 492B
ServerOrderApp.java 835B
server-index
pom.xml 2KB
target
generated-sources
annotations
classes
nemo
spring
study
feign
stock
StockService.class 461B
StockServiceFallback.class 608B
order
OrderService.class 455B
OrderServiceFallback.class 605B
serivce
ExecuteService.class 176B
impl
ExecuteServiceImpl.class 1KB
web
IndexController.class 815B
ServerIndexApp.class 905B
application.properties 1KB
src
test
java
main
resources
application.properties 1KB
java
nemo
spring
study
feign
stock
StockService.java 645B
StockServiceFallback.java 585B
order
OrderServiceFallback.java 583B
OrderService.java 645B
ServerIndexApp.java 920B
serivce
ExecuteService.java 412B
impl
ExecuteServiceImpl.java 1KB
web
IndexController.java 820B
transaction-manager
pom.xml 2KB
target
generated-sources
annotations
classes
application-demo2.properties 2KB
nemo
spring
study
TransactionManagerApplication.class 984B
application-demo1.properties 2KB
application.properties 2KB
src
test
java
main
resources
application-demo2.properties 2KB
application-demo1.properties 2KB
application.properties 2KB
java
nemo
spring
study
TransactionManagerApplication.java 690B
transaction-manager.iml 155B
server-stock
pom.xml 2KB
target
generated-sources
annotations
classes
nemo
spring
study
web
StockController.class 815B
ServerStockApp.class 842B
mapper
StockMapper.class 506B
service
StockService.class 176B
impl
StockServiceImpl.class 1KB
entity
StockEntity.class 2KB
application.properties 1KB
src
test
java
main
resources
application.properties 1KB
java
nemo
spring
study
web
StockController.java 808B
mapper
StockMapper.java 732B
ServerStockApp.java 835B
service
StockService.java 414B
impl
StockServiceImpl.java 955B
entity
StockEntity.java 494B
eureka-server
pom.xml 732B
target
generated-sources
annotations
classes
application-demo2.properties 660B
nemo
spring
study
EurekaServerApplication.class 804B
application-demo1.properties 660B
eureka-server.iml 155B
src
test
java
main
resources
application-demo2.properties 511B
application-demo1.properties 511B
java
nemo
spring
study
EurekaServerApplication.java 751B
共 68 条
- 1
资源评论
- 2019-11-17有没有非mybatis的,基于jdbc的怎么做的?
Nemo_ZR
- 粉丝: 1
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功