其他分享
首页 > 其他分享> > 分布式事务lcn手动回滚

分布式事务lcn手动回滚

作者:互联网

参考:https://www.cnblogs.com/jagerLan/p/10455319.html

事务捕获异常才会进行回滚。如果自己捕获异常,在try catch块里事务需要手动回滚。

分布式事务lcn手动回滚:

不生效,或者无法全部回滚:
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
mqTxManagerService.closeTransactionGroup(TxTransactionLocal.current().getGroupId(),0);

手动回滚其实只需要lcn手动回滚即可,调用接口的方法进行回滚:
mqTxManagerService.cleanNotifyTransaction(TxTransactionLocal.current().getGroupId(),TxTransactionLocal.current().getKid());

 

经测试异常都会回滚。

 

标签:回滚,TxTransactionLocal,手动,事务,current,lcn,分布式
来源: https://www.cnblogs.com/super-chao/p/15113119.html