Rollback of previously committed transactions

In the service I'm currently developing, I need to perform a two-step operation:

  • The executed request must be registered in the database (using the Register() method); and
  • The request should be sent to an external web service for further processing (using the Dispatch() method).

Given that I cannot switch the order of operations, I would like to be able to "roll back" the first if something goes wrong with the second, so that the incorrect record will not be inserted into the BD. The problem here is that, of course, I am committing a transaction inside the Register method. Is there a way to drop it back from the Dispatch method if something goes wrong?

Edit: all transactions are managed from the .NET side.

+4
source share
1 answer

In this case, the database will not help. You must create compensation transactions using pairs of transactions that cancel each other out. Your service will effectively replace all the work and logic that fall into relational databases for transaction management.

+2
source

All Articles