Spring Retry为什么需要具有事务资源的有状态重试?

huangapple go评论54阅读模式
英文:

Why are Spring retry's stateful retries necessary with transactional resources?

问题

Spring retry的README中,他们提到了如何通过使用一个Map来实现“有状态的重试”,以实现回滚事务,而“无状态的重试”不足以做到这一点。

我不太理解他们的意思。

如果我想要一个事务方法来回滚事务并重试一个新的事务,那么有状态的重试和无状态的重试有什么不同呢?

英文:

In Spring retry's README, they mention how a "stateless retry" is not enough to rollback a transaction, but a stateful retry can by using a Map ?

I don't really understand what they mean.

If I want a transactional method to rollback the transaction and retry with a new one, how is a stateful retry different than a stateless retry ?

答案1

得分: 1

为了使事务回滚,异常必须传播到调用者(假设事务在可重试方法的上游某处启动)。

对于无状态的情况,重试是在单个事务范围内执行的。

英文:

In order for the transaction to roll back, the exception must be propagated to the caller (assuming the transaction is started somewhere upstream of the retryable method).

With stateless, the retries are performed within the scope of a single transaction.

huangapple
  • 本文由 发表于 2023年1月9日 02:40:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75050391.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定