How to implement two-phase commit in .Net REST WCF service?

I am creating a RESTful web service and I want to allow it to participate in distributed transactions.

An example scenario would be that my REST service might save a file on the server somewhere, and at the same time, the caller marks this file as stored in its database. However, if either the file server is full, or if its database call failed, another action should not be taken.

What can I do to keep up with me? I would like to find a solution that works for both .NET and Java clients. I know this is a knotty problem, I was wondering if anyone has any tips or ideas? Thanks you

+4
source share
1 answer

If I understand you correctly, you are saying that several requests to different REST endpoints are involved in a distributed transaction.

In this case, you should take a look at this related question , where the answer basically says that distributed transactions are a scenario that conceptually contradicts the principles of REST .

However, you can implement the solution using the workaround described in this answer .
You can also take a look at RETRO, which is a preliminary approach to implementing RESTful transactions, based on the idea of ​​treating each element of an ACID transaction as a resource.

Related Resources:

+4
source

All Articles