Skip to content

Rollback a long workflow transaction in case of any failure. (reposted from slack channel) #4648

Answered by longquanzheng
bantyK asked this question in Q&A
Discussion options

You must be logged in to vote

Some points from myself:

  • You cannot split a DB transaction into different Cadence activities. It simply doesn't work -- because you can't serialize/deserialize the DB connection and pass around Workflow to activities
  • There are different ways to compensate the activities. You can use the Saga pattern similar to this sample, or you can write your own exception handling logic to handle ActivityFailureException
  • For the three types of activity work load, typically workflow state is easiest to rollback, cause it's fully controlled by the workflow code. API is also easy to do as long as it has dedicated support for reverting the operation. Usually a DB transaction is difficult to revert. So an …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@bantyK
Comment options

Answer selected by bantyK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants