Though WS-Coordination is the first spec in line for approval, Robinson called it "perhaps the hardest to understand."
"It deals with the context of the transactions," he said.
Well I'm glad that's clear then.
So what are the origins of the WS-Coordination part of WS-Transaction and what is it all about? WS-Coordination is one of three specs that together comprise WS-Transaction 1.1. The underlying two-phase commit (2PC) and compensating transaction models that underpin the other two specs - WS-AtomicTransaction (WS-AT) and WS-BusinessActivity (WS-BA) - are well-known from the literature (for example Gray&Reuter); WS-AT and WS-BA pretty much just describe an XML structure for the 2PC and compensation model protocol messages that defines those two transaction models. But what about WS-Coordination?
The origins of WS-Coordination are in the CORBA Activity service, which itself was the result of an OMG request for proposals to specify Additional Structuring Mechanisms for the OTS Specification.
CORBA Activity Service.
The Activity service defines a CORBA framework for extended transaction models, recognizing the common attributes of distributed transaction models without preferring any specific one of them. Specifically, the framework defines:
- a generic Activity context that is distributed to Activity participants
- a generic ActivityCoordinator with which Activity participants are registered and which is extended by model-specific SignalSets
- the notion of a transaction-model-specific SignalSet which produces model-specific Signals that the ActivityCoordinator delivers to the registered Actions (participants) and consumes Outcomes that are returned by the Actions. For example, a 2PC SignalSet produces "Prepare", "Commit", "Rollback" etc Signals and consumes "Prepared", "Committed", "Aborted" etc Outcomes.
The Activity service specification defines an overall extended transaction framework architecture but does not explicitly distinguish which parts of the architecture are intended to be provided by middleware infrastructure and which parts are intended to be provided by the transaction-model-provider. Such architectural partitioning is explicitly specified in the J2EE rendering of this architecture - the J2EE Activity service (JSR 95), which finalized in 2006.
J2EE Activity Service
The J2EE Activity service defines Java interfaces for the Activity service objects. It defines the notion of a "High Level Service" (HLS) which embodies a specific transaction model. The J2EE Activity service specification defines a specific contract between a J2EE container and a HLS in much the same way that the Java Connector Architecture specification defines a contract between a J2EE container and a resource adapter.
In the J2EE Architecture, the server runtime implements the ActivityCoordinator interface which supports the registration of participants (Actions), and the UserActivity interface which supports Activity demarcation. The server runtime also marshals/demarshals Activity contexts on remote invocations; the J2EE architecture leverages the CORBA Activity service specification for its definition of interoperable Activity service contexts in much the same way that the EJB specs leverages the CORBA OTS specification for its definition of interoperable transaction service context. Providers of specific transaction protocols can then register a transaction protocol-specific HLS with the container's Activity service to integrate transaction-specific behaviour into the container. Such an HLS implements the SignalSet, Signal, Action and Outcome interfaces that the Activity service drives. The HLS and Activity service cooperate together during transaction completion but maintain separation of concern: the ActivityCoordinator maintains knowledge of which participants are registered, obtains each distinct protocol Signal from the local HLS SignalSet, distributes it to each of those registered participants ("Actions") and feeds the results ("Outcomes") back into the SignalSet.
The WS-Transaction architecture is a Web services evolution of the Activity service, focusing on the interoperable context and Web service messages that flow between coordinator and participant. WS-AT and WS-BA each essentially describe an HLS, defining a transaction-model-specific set of messages. WS-Coordination fulfils the role of the container-provided Activity service, defining the interoperable XML CoordinationContext and the means for participants to be registered with an Activity.
The focus of WS-Transaction is the interoperability between coordinators and participants in different systems; consideration of intra-process separation between the transaction service provider itself and the runtime (application-hosting) container and/or hosted applications is a domain-specific detail that is outside the scope of the Web service specifications. As a result, the WS-Transaction specifications do not define any equivalent of the HLS SignalSet interface nor do they define a generic mechanism for producing and consuming a single (extensible) typed Signal. Instead the WS-Transaction architecture requires each transaction model-specific protocol specification (such a WS-AT and WS-BA) to define its own set of XML protocol messages along with coordinator and participant WSDL portTypes to consume these messages. In common with Activity service HLS's, individual WS-Transaction protocol specifications are at liberty to define model-specific interfaces/protocols to enable applications to demarcate transaction boundaries. WS-AT, for example, defines a Completion portType and protocol through which an application can request the completion of an AT transaction (which then causes the 2PC protocol to be initiated with the registered participants).
Since the WS-Transaction architecture is a Web services evolution of the Activity service, it should be possible to implement it on top of an existing Activity service architecture, right? After all, a significant amount of Web services infrastructure is a thin XML veneer on top of something else, right? Well, yes. I'll blog about how we do that in WebSphere Application Server another day.
This posting has focused on how the CORBA/J2EE Activity service provided much of the inspiration for WS-Coordination. For a discussion on where a number of other extended transaction models, such as BTP and WS-CAF, fit in and compare with WS-Transaction the following articles are useful: