2
votes

Here's the big picture:

Within our new SOA based information system, we need to build several WCF services. Those services' main goal will be to handle business transactions.

Let's have an example: A user place an order on the site (or mobile app), the client application will call a WCF service (let's call it Order Process Manager) that will orchestrate all the business transaction. The OPM will somehow begin a transaction in order to ensure that if a sub process fails, the all transaction is rollbacked.

The point is that the OPM might have to call other services like User Account Service, Stock Manager Service, whatever... Those services might be existing services (that we cannot modify) that call stored procedures that commit and rollback their own transactions. Another possibility is that those other services might be built on top of Entity Framework, having their own way to deal with transaction (using Unit of Work, transaction scope, repositories and stuff...)

My thought is that it won't be as simple as using a transaction scope within the OPM and that it will do all the magic whenever it decides to rollback the all thing.

If anyone has already faced those kinds of issues, I'm all ears!

Environment specifications are:

  • .Net 4.0 / C#
  • WCF
  • SQL Server 2008R2

Many thanks to everyone.

Freddy.

1
you could try to change your DBA Team !Cybermaxs

1 Answers

1
votes

Those services might be existing services (that we cannot modify)

So this is only requirement you need to know to find out that there is no magic solution for you. WCF offers distributed transactions where your OPM could use TransactionScope and propagate transaction to other services but this requires configuration and some coding on both sides - moreover called service must be written by API supporting transaction delegation. Distributed transactions are quite complex and they can have a big performance impact on the system.

If you must work with existing services without possibility to change them your only option is compensation. Compensation is like manual rollback - it is very often used in long running processes where standard transaction with held locks cannot be used. Compensation is you own custom code you call instead of rollback and it will revert all changes made by the current business transaction.