Lets assume I have defined the routing slip activity. Within Execute method I would like to make several asynchronous service calls. Lets assume 3 service calls. Two of them succeed and one fails. Then I would like to execute compensate action of this activity in order to compensate the changes introduced by two succeeded service calls. From what I see the compensation only runs for previous activities, the current activity compensation has no chance to be invoked when there is exception somewhere in it. Is there a way to deal with it or I should change the approach?
Asked
Active
Viewed 489 times
1 Answers
0
You should have three separate activities, and execute them in order, so that as they succeed individually, they are added to the log. If an activity fails, the previous activities will be compensated.
By having all three calls in a single activity, you're going against the entire reason for having the routing slip and activities.

Chris Patterson
- 28,659
- 3
- 47
- 59
-
I have bigger business case to solve. I divided my problem into lets say five steps workflow. Inside each step I need to execute some service calls which modifies remote data. Perfectly those service calls should be run simultaneously. I want to do sth similar what is described here https://github.com/Azure/azure-service-bus/blob/master/samples/DotNet/Microsoft.ServiceBus.Messaging/AtomicTransactions/readme.md. When the 'error' appears inside step the relevant compensation step is executed and then the rest of previous compensation steps. – tgrabus Oct 24 '18 at 21:03
-
basically the exact premise of the sample: https://github.com/phatboyg/Demo-Registration – Chris Patterson Oct 24 '18 at 23:37