seata TM端 TransactionHook 增加上下文参数,支持更好的个性化扩展

mcvgt66p  于 2022-10-22  发布在  其他
关注(0)|答案(2)|浏览(180)

Why you need it?

使用这在进行tm端全局事务扩展的时候,希望能在TransactionHook中的 afterCommit 获取当前事务开启的GlobalTransaction 中获取全局事务提交时的状态,也就是调用getLocalStatus()方法获取本地状态。用于判断提交的处理结果。可以考虑把
TransactionInfo txInfo, GlobalTransaction tx这两个参数都传递到 Hook的方法中,用于个性化处理。

How it could be?

用beginTransaction 举例:
在TransactionalTemplate 类中,可以在 把beginTransaction 方法中 triggerBeforeBegin()方法增加TransactionInfo txInfo, GlobalTransaction tx两个入参,同时对于TransactionHook 的方法补充对应的入参。

Add any other context or screenshots about the feature request here.

fjnneemd

fjnneemd1#

都已经是对应状态的hook了,再加状态的意义是?

rggaifut

rggaifut2#

业务端扩展,增加的hook,现在不能获得当前tm端发起的GlobalTransaction 中的status的状态。所以想通过在hook 的方法中增加当时的 GlobalTransaction 对象,用于业务个性化扩展处理。

相关问题