biedongbin opened a new issue, #7830:
URL: https://github.com/apache/incubator-seata/issues/7830

   ` /**
        * 正向操作代理
        * Seata 会拦截此方法并注册分支事务
        */
       @CompensationBusinessAction(name = "BaseAProxy", compensationMethod = 
"compensate")
       public String execute( @BusinessActionContextParameter(paramName = 
"orderId") String orderId,
                            @BusinessActionContextParameter(paramName = 
"times") int times) {
           System.out.println("BaseAService (Proxy) execute - Calling remote 
base-a...");
           return baseAClient.execute(orderId, times);
       }
   
       /**
        * 补偿操作代理
        * Seata 回滚时自动调用此方法
        */
       public boolean compensate(BusinessActionContext actionContext) {
           String orderId = (String) actionContext.getActionContext("orderId");
           Integer times = (Integer) actionContext.getActionContext("times");
           System.out.println("BaseAService (Proxy) compensate - Calling remote 
base-a compensation...");
           // 此处能拿到 xid  ,但是 在feignclient 的拦截器里面通过 RootContext.getXID() 
拿不到,除非是这里先bind一次
           String xid = actionContext.getXid();
           RootContext.bind(xid);
          // 调用远程服务的补偿接口
           // 确保 compensation 成功
           String result = baseAClient.compensate(orderId, times);
           System.out.println("BaseAService (Proxy) compensation result: " + 
result);
           return true;
       }`
   
   请看上面代码,
   最新2.5.0 版本, saga  注解模式
   回滚代码被调用时 RootContext.getXID() 为Null, 是否未初始化?    这里合理吗?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to