dromara / hmily

Distributed transaction solutions
https://dromara.org
Apache License 2.0
4.11k stars 1.41k forks source link

Tcc调用,向confirm和cancle传递上下文参数 #281

Closed xenosxia closed 3 years ago

xenosxia commented 3 years ago

Tcc调用,try阶段业务逻辑可能使用上下文参数,比如threadlocal中存储的参数,confirm和cancle获取不到对应上下文参数,业务逻辑也就无法保证正确执行。 思路: 1.扩展HmilyInvocation,新增字段 private Map<String, Object> contextParams; 2.HmilyParticipant构建时保存上下文参数到contextParams 3.confirm和cancle执行前将contextParams注入到上下文,执行完清除上下文对应参数。 4.提供函数式接口,让业务应用提供上下文参数获取、注入、清理的实现。

yu199195 commented 3 years ago

good idea ,can you provide this pr?

xenosxia commented 3 years ago

可以,tcc阶段我已经实现,并测试。

yu199195 commented 3 years ago

pr上来,我看看吧