seata-samples
seata-samples copied to clipboard
springboot+dubbo+seata0.8.1 生产者消费者分开部署产生的问题
环境:springboot+dubbo+seata0.8.1 模块1:api模块 @TwoPhaseBusinessAction所在 模块2:consumer @GlobalTransactional所在 模块3:provider 接口服务的实现 现象:Begin new global transaction [192.168.3.167:8091:2023542992] [192.168.3.167:8091:2023542992] commit status:Committed 完全分开实现的seata的tcc模式,全局事务刚开始就提交了,并且provider中提供的commit方法并没有执行。consumer中的try接口中获取的BusinessActionContext参数获取为null。
meet the same problem. dubbo2.7.3 + springboot2.1.9 + seata0.8.1
Hi Please check my correction: first->import io.seata.core.context.RootContext; final String xid = RootContext.getXID(); in each u wanna use the xid like this one, pls use my style: logger.info(String.format("======>prepareMinus account[%s] amount[%f], dtx transaction id: %s.", accountNo, amount, xid));
And...how about the businessActionContext? Seems...the sample writer only use the null value, I also correctted the sample as following codes and for your reference:
public boolean transfer(long from, long to, double amount) throws DemoRpcRunTimeException { BusinessActionContext businessActionContext = new BusinessActionContext(); Map<String, Object> actionContext = new HashMap(); actionContext.put("accountNo", from); actionContext.put("amount", amount); businessActionContext.setActionContext(actionContext);
@gengshidong setting business properties within methods is not currently supported.