开发者

Rolling back previously committed transaction

In the service I a开发者_JAVA百科m currently developing I need to provide a twofold operation:

  1. The request being made should be registered in the database (using Register() method); and
  2. The request should be sent to an external webservice for further processing (using Dispatch() method).

Considering that I can't switch the order of the operations, I would like to be able to "rollback" the first one if something goes wrong with the second, so that a then-invalid record does not get inserted to the BD. The problem here is that, of course, I am commiting the transaction inside the Register method. Is there any way I can roll it back from inside the Dispatch method if anything goes wrong?

Edit: All transaction are being managed from the .NET-side.


The database won't help you in this case. You have to create compensating transactions, using pairs of operations that undo each other. Your services will effectively have to replace all the work and logic that has gone into relational databases for managing transactions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜