3.6.2 Application-Driven Transactional Message Exchange

Transactional message exchange before a two-phase commit in a distributed transaction

Figure 18: Transactional message exchange before a two-phase commit in a distributed transaction

The following steps describe this sequence:

  1. Connect(Begin2) [C6.0]: The application initiates a CONNTYPE_TXUSER_BEGIN2 connection on a DTCO session with the root transaction manager, as specified in [MS-DTCO] section 4.1.1.

  2. Begin [C6.1]: The application sends a TXUSER_BEGIN2_MTAG_BEGIN message to the root transaction manager specifying the isolation level, timeout, transaction description, and isolation flag, as specified in [MS-DTCO] section 4.1.1.

  3. SinkBegun(guidTx) [C6.2]: The root transaction manager creates a transaction object with a globally unique identifier (guidTx), sends a TXUSER_BEGIN2_MTAG_SINK_BEGUN message to the application, and adds the transaction to its list of known transaction objects (as specified in [MS-DTCO] section 4.1.1). When the application receives the TXUSER_BEGIN2_MTAG_BEGUN message from the root transaction manager, the transaction (guidTx) has begun. The application is now free to propagate this transaction to transaction managers, resource managers, and application services to perform work as part of the transaction, as long as it maintains the CONNTYPE_TXUSER_BEGIN2 connection. Eventually, the application determines whether to commit or abort the transaction. If the application disconnects the connection before committing or aborting the transaction, then the root transaction manager will abort the transaction.

  4. Connect(Enlistment) [C7.0]: The resource manager initiates a CONNTYPE_TXUSER_ENLISTMENT connection on a DTCO session with the root transaction manager, as specified in [MS-DTCO] section 4.4.2).

  5. Enlist(guidTx, guidRm) [C7.1]: The resource manager 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 specified in [MS-DTCO] section 4.4.2.

  6. Enlisted [C7.2]: 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, as specified in [MS-DTCO] section 4.4.2. The resource manager continues to maintain the connection and waits for two-phase commit notifications from the root transaction manager.

  7. Connect(TipProxyGateway) [C8.0]: The application initiates a CONNTYPE_TXUSER_TIPPROXYGATEWAY connection on an MSDTC Connection Manager: OleTx Transaction Internet Protocol session with the root transaction manager, as specified in [MS-DTCM] section 4.1.1.

  8. Push2(guidTx,TM2) [C8.1]: The application sends a TXUSER_TIPPROXYGATEWAY_MTAG_PUSH user message, as specified in [MS-DTCM] section 2.2.5.1.3.6, or a TXUSER_TIPPROXYGATEWAY_MTAG_PUSH2 user message, as specified in [MS-DTCM] section 2.2.5.1.3.7, specifying the transaction GUID (guidTx), and the Transaction Internet Protocol (TIP) URL of the remote transaction manager.

  9. Identify(TM1,TM2) [T1.0]: The root transaction manager locates the transaction and creates a new TIP connection with the remote transaction manager in the INITIAL state. The root transaction manager uses the TIP URL specified in the message to create the TIP connection over the TCP transport session established with the remote transaction manager and sends an IDENTIFY command to the remote transaction manager specifying the root transaction manager's primary transaction manager address and the remote transaction manager's secondary transaction manager address, as specified in [MS-TIPP] section 4.1.1.

  10. Identified [T1.1]: When the remote transaction manager receives the IDENTIFY command, the remote transaction manager sends an IDENTIFIED command to the root transaction manager and the state of the TIP connection is changed to IDLE, as specified in [MS-TIPP] section 4.1.1.

  11. Push(guidTx) [T1.2]: When the root transaction manager receives the IDENTIFIED command, the root transaction manager sends a PUSH command to the remote transaction manager specifying the primary's transaction identifier (guidTx), as specified in [MS-TIPP] section 4.1.2.2.

  12. Pushed(subTx) [T1.3]: When the remote transaction manager receives the PUSH command, the remote transaction manager adds the transaction to its list of transaction objects with a newly created transaction identifier (subTx), sends a PUSHED command to the root transaction manager, and the state of the TIP connection changes to ENLISTED, as specified in [MS-TIPP] section 4.1.2.2.

  13. Pushed(subTx) [C8.2]: When the root transaction manager receives the PUSHED command, the root transaction manager sends a TXUSER_TIPPROXYGATEWAY_MTAG_PUSHED message to the application specifying the remote transaction manager 's transaction identifier (subTx), as specified in [MS-DTCM] section 4.2.3. When the application receives the TXUSER_TIPPROXYGATEWAY_MTAG_PUSHED message, the application initiates the disconnect sequence on the CONNTYPE_TXUSER_TIPPROXYGATEWAY connection.

  14. Connect(Associate) [C9.0]: The external resource manager initiates a CONNTYPE_TXUSER_ASSOCIATE connection on a DTCO session with the external transaction manager, as specified in [MS-DTCO] section 4.2.2.

  15. Associate(guidTx,TM1) [C9.1]: The external resource manager sends a TXUSER_ASSOCIATE_MTAG_ASSOCIATE message to the external transaction manager specifying the transaction identifier (guidTx) and sufficient information (the root transaction manager's machine name and endpoint GUID) to establish a DTCO session with the root transaction manager, as specified in [MS-DTCO] section 4.2.2.

  16. Connect(Branch) [C10.0]: The external transaction manager attempts to locate the transaction in its list of transaction objects by using the transaction identifier (guidTx). Because the transaction object is not located, the external transaction manager attempts to pull the transaction from the root transaction manager by using information contained in the message, and therefore the external transaction manager initiates a CONNTYPE_PARTNERTM_BRANCH connection on a DTCO session with the root transaction manager, as specified in [MS-DTCO] section 4.2.3.

  17. Branching(guidTx) [C10.1]: The external transaction manager sends a PARTNERTM_BRANCH_MTAG_BRANCHING message with the transaction identifier (guidTx) of the requested transaction to the root transaction manager, as specified in [MS-DTCO] section 4.2.3.

  18. Branched [C10.2]: The root transaction manager creates a subordinate branch and sends a PARTNERTM_BRANCH_MTAG_BRANCHED message to the external transaction manager, as specified in [MS-DTCO] section 4.2.3.

  19. Associated [C9.2]: The external transaction manager keeps the connection open to process two-phase commit notifications from the root transaction manager and sends a TXUSER_ASSOCIATE_MTAG_ASSOCIATED message to the external resource manager on the CONNTYPE_TXUSER_ASSOCIATE connection to inform the external resource manager that the pull operation was successful, as specified in [MS-DTCO] section 4.2.2. The external transaction manager continues to maintain the CONNTYPE_PARTNERTM_BRANCH connection with the root transaction manager and waits for two-phase commit processing. When the external resource manager receives the TXUSER_ASSOCIATE_MTAG_ASSOCIATED message, the external resource manager initiates the disconnect sequence on the CONNTYPE_TXUSER_ASSOCIATE connection.

  20. Connect(LuRmEnlistment) [C11.0]: The external resource manager initiates a CONNTYPE_TXUSER_DTCLURMENLISTMENT connection on a DTCLU session with the external transaction manager, as specified in [MS-DTCLU] section 4.4.1.

  21. Create(guidTx,LuPair) [C11.1]: The external resource manager sends a TXUSER_DTCLURMENLISTMENT_MTAG_CREATE message to the external transaction manager specifying the transaction identifier (guidTx) and the LU Name Pair (LuPair), as specified in [MS-DTCLU] section 4.4.1.

  22. RequestComplete [C11.2]: The external transaction manager creates an LU enlistment on the transaction and sends a TXUSER_DTCLURMENLISTMENT_MTAG_REQUEST_COMPLETED message to the external resource manager, as specified in [MS-DTCLU] section 4.4.1. When the external resource manager receives the TXUSER_DTCLURMENLISTMENT_MTAG_REQUEST_COMPLETED message, the external resource manager continues to maintain the connection and waits for two-phase commit processing.

  23. Stats(open++) [C1.5]: Because the transaction (guidTx) is active but not yet committing or aborting, the root transaction manager sends an MSG_DTCUIC_STATS message to the management tool with the number of open transactions incremented by one (open++), as specified in [MS-CMOM] section 3.2.1.1.

  24. TranList(guidTx:Open) [C1.6]: The root transaction manager sends an MSG_DTCUIC_TRANLIST message to the management tool listing the transaction (guidTx) in the open state (XACTSACT_OPEN), as specified in [MS-CMOM] section 3.2.1.1.