Skip to content

How can we handle DB Transactions? #4

Answered by Mulkave
yasalkhatib asked this question in Q&A
Discussion options

You must be logged in to vote

If i understand correctly you're looking into a reversal in case one of these jobs fail? If so, this is an interesting case!

This makes a good case for an operation.

Important
Before going into the details, I'd like to highlight that these are usually handled at the DB layer and not at the architecture layer, where you would create a DB transaction which will revert itself when things don't go as planned.


However, if you were to do it manually at the architecture level, here's one suggestion to make it happen:

  • TransferMoneyOperation($fromAccount, $toAccount) -> returns TransferStatus object summarising the jobs' results
    • WithdrawMoneyFromAccountJob($fromAccount, $amount)
    • DepositMoneyInA…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Mulkave
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
Converted from issue

This discussion was converted from issue #4 on December 10, 2020 19:57.