Closed aqHi closed 3 years ago
初步分析是XID不同步,请查看seata相关文档
@Slf4j
@Configuration
public class FeignXidRequestInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
String xid = RootContext.getXID();
if (StringUtils.isNotBlank(xid)) {
log.info("feign 获得分布式事务xid:" + xid);
} else {
log.debug("feign 获得分布式事务xid为空");
}
template.header(RootContext.KEY_XID, xid);
}
}
Please fill it out carefully, or it will be closed. 请认真填写,不然会直接关闭。
Enviroment
JDK Version(required): 1.8
SpringBoot Version(required): 2.3.5.RELEASE
dynamic-datasource-spring-boot-starter Version(required):3.2.1
druid Version(optional):
Describe what happened
服务A , B 均为为多数据源 ,eureka 为注册中心 ,A中方法开启全局事务,通过feign调用B,A中异常B无法回滚。
参考过
seata
官方的demo: https://github.com/seata/seata-samples/tree/master/springcloud-eureka-feign-mybatis-seata 也参考过: https://github.com/dynamic-datasource/dynamic-datasource-samples/tree/master/tx-seata-sample对分布式事务不是很熟悉,想请教下问题出在哪儿 , 另外有没有 tx-seata-sample 集成 eureka + feign 的 demo ,感谢🙏
A中 OrderService 调用B的方法
Expected Result:
Actual Result:
If there is an exception,or aop invalid,please attach the exception trace:
Steps to reproduce
Step 1
Step 2
Step 3