-
1. Re: WS-BA Compensation Order?
adinn Dec 10, 2008 5:43 AM (in response to elwood_j_blues)The WS-BA spec does not define an order for complete, close and/or compensation notifications to be dispatched from the coordinator. It allows the implementation to do it how it likes, including parallel dispatch of a given notification to multiple participants. I believe we have a JIRA slated to implement the latter at some stage.
Even if we provided some order guarantee for participant notifications in the JBoss implementation it would be unwise for your web services to depend on it. This would limit its ability to interoperate wiht other coordinator implementations.
The specific case in question is interesting. Both your participants are trying to modify the same resource. Arguably, you should have one participant handling all web service requests in the same activity rather than one per request. If you choose to register a participant for each request then in order to make your web services safe you need at the very least to be locking and updated a shared record of the changes made to the resource by each participant. Your compensation actions could then refer to this shared resource. How you do that (including how you make it persistent between complete and close/compensate) will require some thinking through which I will leave as an exercise for the reader. -
2. Re: WS-BA Compensation Order?
elwood_j_blues Dec 10, 2008 11:53 AM (in response to elwood_j_blues)Thanks for confirming what I was already thinking: That I must not rely on a compensation order. I am, in fact, not manipulating the same resource from different services, but multiple calls to the same service, each one of which registers itself with the BA with participant completion. After all, after each distinct manipulation, the service says "my work here is done". It's only the client who decides if or if not to call the web service again after that.
Maybe I need to use coordinator completion here: As it does not lie in the discretion of the service if it gets to modify the resource only once, or maybe 10 times, and they are incremental changes, this may be the only way for me to be able to compensate the whole batch in the right order. -
3. Re: WS-BA Compensation Order?
adinn Dec 10, 2008 12:03 PM (in response to elwood_j_blues)
Maybe I need to use coordinator completion here: As it does not lie in the discretion of the service if it gets to modify the resource only once, or maybe 10 times, and they are incremental changes, this may be the only way for me to be able to compensate the whole batch in the right order.
Yup, that's what I was hinting at. In fact if you do this your web service will keep a running total and write the whole set of credits/debits once at complete then either close or compensate them all at once depending upon the outcome.