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

SAGA Loop循环事务补偿入参问题咨询 #6776

Open
geniusnoopy opened this issue Aug 23, 2024 · 4 comments
Open

SAGA Loop循环事务补偿入参问题咨询 #6776

geniusnoopy opened this issue Aug 23, 2024 · 4 comments

Comments

@geniusnoopy
Copy link

Ⅰ. Issue Description

SAGA Loop循环事务补偿入参问题咨询。

Ⅱ. Describe what happened

使用SAGA Loop循环事务时,当事务发生补偿,循环事务里的单个子事务补偿方法入参无法获取到集合单个元素及集合下标。
试了test用例中的org.apache.seata.saga.engine.db.StateMachineDBTests.testSimpleStateMachineWithLoopCompensate()方法,似乎也无法获取到。
请问需要如何配置才能在Loop子事务补偿时入参获取到集合单个元素信息。

Ⅵ. Environment:

  • JDK version(e.g. java -version):8
  • Seata client/server version: 2.0.0
@wt-better
Copy link
Contributor

你所谓的补偿是forward还是compensate,forward的话可以使用$.[element],$.[collection]这种;如果是compensate,目前没有机制透传;

@ptyin
Copy link
Member

ptyin commented Aug 23, 2024

ProcessContext 获取 DomainConstants.LOOP_COUNTER 这个变量是你想要的吗?

@geniusnoopy
Copy link
Author

你所谓的补偿是forward还是compensate,forward的话可以使用$.[element],$.[collection]这种;如果是compensate,目前没有机制透传;

是compensate,感谢解答。另外有个疑问是在LoopTaskHandlerInterceptor的preProcess里有compensate时的原ContextVariable获取的相关代码,请问后续是否能够支持?

@geniusnoopy
Copy link
Author

ProcessContext 获取 DomainConstants.LOOP_COUNTER 这个变量是你想要的吗?

你好,循环事务在补偿时context里似乎没有loopcounter这个key。

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

3 participants