3.8.4.1.1 Commit (Opnum 3)

The Commit method commits a pending transaction represented by its TransactionImpl (section 3.8) instance.

 HRESULT Commit(
   [in] short fRetaining,
   [in] DWORD grfTC,
   [in] DWORD grfRM
 );

fRetaining: A short that represents a BOOLEAN value that specifies whether to retain the transaction when it is finished.

grfTC: A DWORD that corresponds to the XACTTC (section 2.2.2.21) enumeration.

grfRM: A DWORD that is reserved for future use. For internal transactions, this parameter MUST be 0x00000000 in order to ensure success. For more details about this input parameter for DTC transactions, refer to [MS-DTCO] section 2.2.7.1.

Return Values: The method MUST return S_OK (0x00000000) to indicate success or an implementation-specific error HRESULT on failure.<30>

When processing this call, the server MUST follow these guidelines:

  • If the isInternal instance variable is True:

    • If the grfRM input parameter is not equal to 0, or if the fRetaining input parameter is equal to True, or if the grfTC input parameter is not equal to XACTTC_SYNC (0x00000002):

      • Return XACT_E_NOTSUPPORTED (0x8004D00F), and take no further action.

    • If the isCommitedorAborted instance variable is True:

      • Return MQ_ERROR_TRANSACTION_SEQUENCE (0xC00E0051), and take no further action.

    • Generate a Transaction Commit event as defined in [MS-MQDMPR] section 3.1.4.4 with the following inputs:

      • iTransactionIdentifier = TransactionIdentifier instance variable of this transaction object.

  • Else:

    • Send a commit request to the distributed transaction manager, which eventually triggers the Transaction Commit event on the QueueManagers that are enlisted in the transaction. The Transaction Commit event carries the TransactionIdentifier instance variable of this transaction object. For more details about the commit request to the distributed transaction manager, refer to [MS-DTCO] sections 2.2.8.1.2.3 and 3.3.4.8.1. For more details about the outcome of the Transaction Commit event, refer to [MS-MQDMPR] section 3.1.4.4.

    • If any errors are generated by the distributed transaction manager:

      • Return an error HRESULT, and take no further action.

  • Set the isCommittedorAborted instance variable to True.