3.1 Example 1: Perform Transaction Work
This example demonstrates performing a transaction that involves two transaction managers as described in Perform Transaction Work – Application (section 2.5.1).
Prerequisites:
Transaction processing services meet all the preconditions that are described in section 2.4.
Transaction processing services are operational.
The application can access a transaction manager in the system.
Initial System State
No transaction has been performed by an application.
Final System State
The application performs a transaction that involves two transaction managers.
Sequence of Events

Figure 12: Example of performing a transaction with two transaction managers
The following steps describe the sequence:
The resource manager connects to the root transaction manager by initiating a CONNTYPE_TXUSER_RESOURCEMANAGER connection on a DTCO session with the root transaction manager and sends a TXUSER_RESOURCEMANAGER_MTAG_CREATE message to the root transaction manager, as specified in [MS-DTCO] section 4.4.1, to register with it.
The root transaction manager sends a TXUSER_RESOURCEMANAGER_MTAG_REQUEST_COMPLETE message, as described in [MS-DTCO] section 4.4.1, to the resource manager to acknowledge that the resource manager is registered with the root transaction manager as a resource manager.
The remote resource manager connects to the remote transaction manager by initiating a CONNTYPE_TXUSER_RESOURCEMANAGER connection on a DTCO session with the remote transaction manager and sends a TXUSER_RESOURCEMANAGER_MTAG_CREATE message to the remote transaction manager, as described in [MS-DTCO] section 4.4.1, to register with it.
The remote transaction manager sends a TXUSER_RESOURCEMANAGER_MTAG_REQUEST_COMPLETE message, as specified in [MS-DTCO] section 4.4.1, to the remote resource manager to acknowledge that the remote resource manager is registered with the remote transaction manager as a resource manager. The management tool performs a Subscribe for Transaction Information action against the root transaction manager to monitor the progress of the two-phase commit protocol and to resolve the transaction if it reaches an error state.
The application sends a TXUSER_BEGINNER_MTAG_PROMOTE message to the root transaction manager over a CONNTYPE_TXUSER_PROMOTE connection on a DTCO session by specifying the isolation level, timeout, transaction description, isolation flag, and transaction identifier or sends a TXUSER_BEGIN2_MTAG_BEGIN message to the root transaction manager over a CONNTYPE_TXUSER_BEGIN2 connection on a DTCO session specifying the isolation level, timeout, transaction description, and isolation flag to create a Transaction action against the root transaction manager, as specified in [MS-DTCO] section 3.3.4.1.
The root transaction manager creates the transaction object with a globally unique identifier (GUID) (guidTx), sends a TXUSER_BEGIN2_MTAG_SINK_BEGUN message to the application, and adds the transaction to its list of known transaction objects, as described in [MS-DTCO] section 4.1.1 to complete the Create Transaction action that was initiated in step 5.
The application initiates a Perform Transaction Work action against the resource manager.
The resource manager initiates a CONNTYPE_TXUSER_ENLISTMENT connection on a DTCO session with the root transaction manager and sends a TXUSER_ENLISTMENT_MTAG_ENLIST message to the root transaction manager specifying the transaction GUID (guidTx), and the GUID that uniquely identifies itself (guidRm), as described in [MS-DTCO] section 4.4.2, to initiate an Enlist action against the root transaction manager.
The root transaction manager enlists the resource manager in the requested transaction, adds the resource manager to its list of subordinates for the transaction, and sends a TXUSER_ENLISTMENT_MTAG_ENLISTED message to the resource manager to acknowledge that the resource manager is enlisted in the transaction, as described in [MS-DTCO] section 4.4.2.
The resource manager reports successful completion of the transaction work, completing the Perform Transaction Work action that was initiated in step 7.
The application initiates a Perform Transaction Work action against the application service by passing a serialized transaction identifier that includes the transaction propagation information.
The application service initiates a CONNTYPE_TXUSER_ASSOCIATE connection on a DTCO session with the remote transaction manager and sends a TXUSER_ASSOCIATE_MTAG_ASSOCIATE message to the remote transaction manager by using the transaction information and propagation information, as described in [MS-DTCO] section 4.2.2.
The remote transaction manager initiates a CONNTYPE_PARTNERTM_BRANCH connection on a DTCO session with the root transaction manager and sends a PARTNERTM_BRANCH_MTAG_BRANCHING message to the root transaction manager, specifying the serialized transaction identifier, as described in [MS-DTCO] section 4.2.3.
The root transaction manager creates a subordinate branch and sends a PARTNERTM_BRANCH_MTAG_BRANCHED message to the remote transaction manager, as described in [MS-DTCO] section 4.2.3, to acknowledge that the remote transaction manager is now enlisted in the transaction, completing the Pull Transaction action that was initiated in step 13.
The remote transaction manager sends a TXUSER_ASSOCIATE_MTAG_ASSOCIATED message to the application service on the CONNTYPE_TXUSER_ASSOCIATE connection, as specified in [MS-DTCO] section 4.2.2, completing the Request Pull Transaction action that was initiated in step 12.
The application service initiates a Perform Transaction Work action against the remote resource manager.
The remote resource manager connects to the remote transaction manager by initiating a CONNTYPE_TXUSER_ENLISTMENT connection on a DTCO session with the remote transaction manager and sends a TXUSER_ENLISTMENT_MTAG_ENLIST message to the remote transaction manager specifying the transaction identifier (guidTx), the resource manager identifier (guidRm), and the resource manager session identifier (guidSession), as described in [MS-DTCO] section 4.4.2, to initiate an Enlist action against the remote transaction manager.
The remote transaction manager adds the resource manager to its list of subordinate enlistments and replies to the remote resource manager with a TXUSER_ENLISTMENT_MTAG_ENLISTED message to acknowledge that the remote resource manager is enlisted in the transaction, as specified in [MS-DTCO] section 4.4.2.
The remote resource manager reports successful completion of transacted work by completing the Perform Transaction Work action that was initiated in step 16.
The application service responds to the application by completing the Perform Transaction Work action that was initiated in step 11.
The application completes the transaction by sending a TXUSER_BEGIN2_MTAG_COMMIT user message to the root transaction manager transaction, as described in [MS-DTCO] section 4.1.2.1.