能否在一个方法上同时使用@SagaStart @Compensable以实现嵌套事务?
You can use the SagaStart with the Compensable together on the same method. But we don't support define a new StagaStart inside of a SagaStart.
We have the https://issues.apache.org/jira/browse/SCB-836 to work on the nested saga support.
We have the https://issues.apache.org/jira/browse/SCB-836 to work on the nested saga support.
Have any plan on this feature? or any implementation doc ?
yeah, I had done some works on this feature but did not prepare for a PR.
The implementation I have is actually:
- When calling initializeOmegaContext(), it could check the current omega context to see if there is already an globalTxId and to set the parentTxId with it.
- Add the X-Pack-Parent-Transaction-Id to propagate the parentTxId during the services.
- The alpha server will update to find the transactions with the parentTxId when rolling back the global transaction.
- Add and update the tests to work with the nested saga transactions. 4.1 Test the global transaction and sub nested transactions are success. 4.2 Test the one nested saga transaction is success and the other one is rolled back but the global transaction is success. 4.3 Test the one nested saga transaction is success and the other one is rolled back but the global transaction is rolled back. It should roll back the success nested one.
Anyway, I just finished work on the 1) and 2). I will be happy to see if you have any idea about this implementation and work together with me to support the nested saga in servicecomb-pack.
Thanks
@tinycedar just to mention that I create https://github.com/apache/servicecomb-pack/pull/432 which contains my changes about this issue.