当前位置:   article > 正文

springcloud 服务事务一致性

工作流云服务与本地事务一致性

springboot搭建微服务架构,采用Feign进行服务之间的远程调用,配置fallback实现服务降级,配置服务降级配置,主服务监听调用服务返回的内容,判断继续执行还是抛出异常。从而保证逻辑一致性。

1.配置服务调用

@FeignClient(name = "user-service",fallback = UserClientFallback.class)
public interface UserClient {

@PostMapping("/user/authPayStatusUpdateRemote")
CommonResponse authPayStatusUpdate(@RequestBody CreateUserRequest reques);

@PostMapping("/user/userVIPUpdateRemote")
CommonResponse userVIPUpdateRemote(@RequestBody CreateVIPRequest reques);

@PostMapping("/user/userCompanyAuthUpdateRemote")
CommonResponse userCompanyAuthUpdateRemote(@RequestBody CreateVIPRequest reques);

@PostMapping("/user/userCompanyRenewAuthUpdateRemote")
CommonResponse userCompanyRenewAuthUpdateRemote(@RequestBody CreateVIPRequest reques);

@PostMapping("/user/userInfoRemoteQuery")
CommonResponse userInfoRemoteQuery(@RequestBody UserRemoteRequest request);

@PostMapping("/user/queryUserRecommendRemot")
CommonResponse queryUserRecommendRemot(@RequestBody UserRemoteRequest reques);

@PostMapping("/user/addUserwalletRemot")
CommonResponse addUserwalletRemot(@RequestBody UserRemoteRequest reques);

@PostMapping("/user/queryUserUidRemote")
CommonResponse queryUserUidRemote(@RequestBody UserRemoteRequest request);

@Component
static class UserClientFallback implements UserClient {
@Override
public CommonResponse authPayStatusUpdate(CreateUserRequest reques){
return null;
}

@Override
public CommonResponse userVIPUpdateRemote(CreateVIPRequest reques){
return null;
}

@Override
public CommonResponse userCompanyAuthUpdateRemote(CreateVIPRequest reques){
return null;
}
}
}

转载于:https://www.cnblogs.com/flyyu1/p/11465824.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/428841
推荐阅读
相关标签
  

闽ICP备14008679号