biedongbin commented on issue #7840:
URL: 
https://github.com/apache/incubator-seata/issues/7840#issuecomment-3680132336

   > 
所以如果SagaAnnotationResourceManager中执行hook,实际上多数据源就可以通过hook来实现不是吗?beforehook里切换数据源,afterhook中清除上下文之类的操作。所以我觉得可以先提个pr使hook生效,然后再通过这些hook。然后你可以根据你的设计画几个流程图吗?这样看着会更清晰直观一些。
   > 
   > So if SagaAnnotationResourceManager executes hooks, couldn’t 
multi-datasource support be implemented via those hooks? For example, switch 
the data source in the beforeHook and clear the context in the afterHook. I 
suggest we first open a PR to enable the hooks, and then implement the 
multi-datasource logic using them. Could you also draw a few flow diagrams 
based on your design? That would make the approach much clearer and more 
intuitive.
   
   SagaAnnotationResourceManager 中执行hook  可以解决 多数据源问题,不过  saga 注解 我理解设计的本质目的 
或者说 我这边使用Saga 注解模式的本质原因就是因为 足够轻量级,以及可以减少业务代码侵入 和业务耦合性,所以 使用 Fence  db 模式 
我们是不愿意用的、增加了系统复杂度 也增加开销,通过业务上下文新增业务状态字段至少对我们是最优解
   
   
   <img width="2649" height="5222" alt="Image" 
src="https://github.com/user-attachments/assets/6bdcfa96-a9ee-4635-a169-52a350eb0b99";
 />
   
   
   
   aggregate-01:TM (Transaction Manager) + RM (BaseA 代理)
             聚合服务,使用 @GlobalTransactional 开启全局事务。内部封装 BaseAService 
代理类(feignclient  调用 base-a的 T和C接口),为 base-a 开启分支事务并支持补偿
   base-a:普通服务,未集成sata框架, 堆外提供了 Http  的  T/C 接口
   base-b:RM (Resource Manager),使用 @CompensationBusinessAction 实现 Saga 补偿
   ===
   这是我封装后代码使用的流程图
   
   <img width="3163" height="2524" alt="Image" 
src="https://github.com/user-attachments/assets/0c93b4c5-84e1-4202-8f30-55648918d9e9";
 />
   
   
[SagaTransactionService.java](https://github.com/user-attachments/files/24283313/SagaTransactionService.java)


-- 
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