I have several services that insert/update records on tables.
Each of these services (A,B,C) have the following structure:
1.StartTransaction (store in localVariable)
2.2 CommitTransaction (localVariable)
3.2 RollbackTransaction (localVariable)
The services work ok, so far so good…
But now I need another service that needs to call several of these services
1.StartTransaction (store in lVariable)
2.1 call service A
2.2 call service B
2.3 call service C
2.4 CommitTransaction (lVariable)
3.1 Error Logic
3.2 RollbackTransaction (lVariable)
My issue here is that if any of the services A, B or C fails, the main service should rollback without commiting anything to the DB.
What is actually happening is that when service B fails, the main service rollbacks but changes made by A are already commited and do not rollback!