Fault in Compensation Handler

Hello. I'm currently trying to figure out what's the inteded behaviour of a compensation handler that faults. In chapter 12.4.4.3 "Compensation within Compensation Handlers" (page 126 in the PDF version) of the BPEL 2.0 specification (http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html) it is stated that a faulted compensation handler "will undo its partial work by compensating all scopes immediately enclosed by the root scope according to the fault handler of the root scope. If such a fault handler is not specified explicitly, partial work will be compensated in the default order [...]."

The problem is that I'm unsure what the term "root scope" denotes in that context. In the beginning of chapter 12.4.1 (page 118) it is stated that a compensation handler is a wrapper of an activity. So in principle that activity could be a sequence of scopes or just a basic activity like an invoke. I'm wondering what the root scope in that cases would be ?
In the same chapter (12.4.4.3, p. 126) it is also stated that a root scope enclosed by a compensation handler may not have a compensation handler. But in the case of a compensation handler containing a sequence of scopes I'm unsure how an "all-or-nothing" semantics could be established. No scope of the sequence contained in the compensation handler may have a compensation handler. Consequently if e.g. the third scope of the sequence faults its work will be compensated by its fault handler and the fault will be forwarded to the caller of the compensation hanler. But still the overall compensation will then only be undone partially because the work of the first two scopes of the sequence wouldn't be reverted.
Another topic in respect to this behavior (12.4.4.3, p. 126) is that a fault that occurs inside such a root scope enclosed in a compensation handler must be propagated up to the caller of the compensation handler. So assuming that this root scope itself consists of several nested scopes and the fault occurs in the inner most scope the fault would usually be caught by the fault handler of that inner most scope. But in order to guarantee the mentioned behaviour those fault handlers would have to rethrow the fault up to the compensation handler which also has to rethrow the fault in order to propagate the fault up to the caller of the compensation handler. That would mean that the behaviour of those fault handlers contained in those nested scope would have to be restricted to that behaviour.

I'd be grateful for any information.

Best regards,
David Spieler

If you have a compensation handler that contains a sequence with three scopes then the first two scopes will be compensated if the third scope faults.

The rule you're referencing is intended to prevent people from defining compensation handlers that are unreachable. In the case of a sequence of scopes S1, S2, S3 within a compensation handler, compensation handlers on those scopes are reachable until the compensation handler completes.

If the immediate child activity of a compensation handler is a scope then this scope is not allowed to have a compensation handler. I believe in this case such a scope is referred to as a "root" scope. Nothing prevents you from having a sequence of scopes within the root scope, all of which may define compensation handlers.

In the absence of a root scope, then the default fault handler's behavior will apply. In this case all of the eligible scopes are compensated in default order and the fault is rethrown.

Thank you very much for your answer which clarified my interpretation.

Best regards,

David Spieler 

XML.org Focus Areas: BPEL | DITA | ebXML | IDtrust | OpenDocument | SAML | UBL | UDDI
OASIS sites: OASIS | Cover Pages | XML.org | AMQP | CGM Open | eGov | Emergency | IDtrust | LegalXML | Open CSA | OSLC | WS-I