WillemJiang commented on issue #590: 事务失败后做补偿操作(cancel)抛异常,事务结束
URL: 
https://github.com/apache/servicecomb-pack/issues/590#issuecomment-552102233
 
 
   > 1.版本0.5.0,用的是saga-spring-demo,alpha没有使用状态机
   > 
https://github.com/apache/servicecomb-pack/blob/a89c7cd8b416c9b281fdbe28644cb6b7e2e78f91/omega/omega-context/src/main/java/org/apache/servicecomb/pack/omega/context/CallbackContext.java
   > 在apply方法中try catch住了cancel方法的异常,但是只打印了log,然后接着执行 sender.send(new 
TxCompensatedEvent(globalTxId, localTxId, parentTxId, compensationMethod));
   > alpha收到TxCompensatedEvent后就更新command状态为dnwn增加sagaEndedEvent就结束事务了。
   > 
在整个过程中catch住了异常,但是接下来的处理逻辑和没有发生异常时是一样的。这样从数据记录就看不出补偿是否成功。不知道是不是我那里缺少配置造成的还是有其他的处理方式?
   
   CallbackContext 抓住的异常是和回调方法相关的,这些异常有可能和你的配置有关。 
   因为如果不忽略这样的异常,Alpha下发的命令在下一次执行的时候还是有可能失败,因此通过日志输出方式来处理这样的问题。 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to