#seata1.3+nacos1.3 fegin 没有自动传递xid
调用方代码
@GlobalTransactional(timeoutMills = 300000, name = "test_seate_all_transaction_name",rollbackFor = Exception.class )
@override
public Object zhix(String tx) {
String xId = RootContext.getXID();
jdbcTemplate.update("update seata_test set name = 'basic_"+ UuidUtil.uuid() +"' where id = 1");
String txt = checkRfidClient.textTx(xId);
if(System.currentTimeMillis()%2 == 0)
{
System.out.println(1/0);
}
return FastMap.newDefaultInstance()
.set("Tx txt",txt);
}
#被调用方
@RequestMapping(value = "/rfid/test")
@transactional
public Object testTx(@requestbody String xId){
RootContext.bind(xId);//必须指定,否则拿到null??
jdbcTemplate.update("update seata_test set name = 'rfid_"+ UuidUtil.uuid() +"' where id = 1");
return xId+"_testTx";
}