We have a situation where we need to manage db transaction across multiple rest api call.
In traditional example where new customer is registered, ordered, and payment done with different micro services.
We do have list of DB Micro REST Services and combination of SOAP and REST service which will used for business rule implementation.
Question is : how i am able to add transaction management wrapper around that so that it will rollback db data when only one getting failed.
I ready blogs of XA Transactions, but not able to get it how to use in my main project from where i am calling 1. 5 DB Micro Services 2. 1 External SOAP Service 3. 2 External REST Service.
Can someone help me out?
Thanks in Advance
Web technologies like SOAP en REST are not fit for participating in (XA) transactions. They are created for communication between independent systems that could potentially be located on the other side of the world. While it is technically possible to do it with SOAP (see for WS-Transaction on google) I would strongly advise against it because
You need a totally different architecture that involves saga's that orchestrate the calls to the different services and contain retry or compensation logic to cope with any of them failing. There are plenty of good articles on life without distributed transactions that explain these concepts. Far too complex to explain here.