Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request:以更直观的 Concurrent 来表达并行 #379

Open
speedoops opened this issue Dec 1, 2022 · 1 comment
Open

Feature Request:以更直观的 Concurrent 来表达并行 #379

speedoops opened this issue Dec 1, 2022 · 1 comment

Comments

@speedoops
Copy link

speedoops commented Dec 1, 2022

现在的并发是如下写法,其中用数字0、1、2……来表达顺序依赖:

	saga := dtmcli.NewSaga(DtmServer, shortuuid.New()).
		Add(Busi+"/CanRollback1", Busi+"/CanRollback1Revert", req).
		Add(Busi+"/CanRollback2", Busi+"/CanRollback2Revert", req).
		Add(Busi+"/UnRollback1", "", req).
		Add(Busi+"/UnRollback2", "", req).
		EnableConcurrent().
		AddBranchOrder(2, []int{0, 1}). // 指定step 2,需要在0,1完成后执行
		AddBranchOrder(3, []int{0, 1}) // 指定step 3,需要在0,1完成后执行

期望支持如下表达式,以更直观的 Concurrent 来表达并行:

	saga := dtmcli.NewSaga(DtmServer, shortuuid.New()).
		Concurrent(
			Add(Busi+"/CanRollback1", Busi+"/CanRollback1Revert", req),
			Add(Busi+"/CanRollback2", Busi+"/CanRollback2Revert", req)
		).
		Add(Busi+"/UnRollback1", "", req).
		Add(Busi+"/UnRollback2", "", req)
@yedf2
Copy link
Contributor

yedf2 commented Dec 1, 2022

欢迎pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants