Delen via


MSMQTransaction.Commit

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The Commit method of the MSMQTransaction object, which identifies the underlying transaction object, commits the transaction represented by the MSMQTransaction object, requesting performance of all the operations included in the transaction.

Sub Commit( _  
  [ ByRef fRetaining As Variant ], _  
  [ ByRef grfTC As Variant ], _  
  [ ByRef grfRM As Variant ] _  
  )  

Parameters

fRetaining

[in, optional] Boolean (in C++, a reference to a VARIANT containing a VARIANT_BOOL). The default is False. Reserved by Microsoft® Distributed Transaction Coordinator (MS DTC).

grfTC

[in, optional] One of the following constants that specifies whether the commit is synchronous (default) or asynchronous (in C++, a reference to a VARIANT containing a LONG that specifies the constant):

XACTTC_ASYNC: When specified, the call to commit returns as soon as the two-phase commit protocol is initiated.

XACTTC_SYNC_PHASEONE: When specified, the call to commit returns after phase one of the two-phase commit protocol.

grfRM

[in, optional] Long (in C++, a reference to a VARIANT containing a LONG). The default is 0. Reserved by MS DTC.

Return Values

This method has no return values.

Error Codes

For a complete list of error and information codes, see Message Queuing Error and Information Codes.

Remarks

Calling Commit does not mean that the operations requested are performed. It only means that Message Queuing guarantees that the operations will be performed as an atomic unit or not performed at all.

Commit is a wrapper for lTransaction::Commit. (For information on ITransaction::Commit, see the Platform SDK.)

An application must call Commit for the messages to be sent. If Commit is not called, the transaction will be terminated when the application exits.

For information on Microsoft Distributed Transaction Coordinator (MS DTC or DTC), see the Platform SDK.

For information on See
The Message Queuing transaction model Transactions
The types of transaction supported by MSMQ Transaction Types
How Message Queuing sends and retrieves messages within a transaction Sending and Retrieving Messages within a Transaction

Example Code

The following examples are included in Using Message Queuing.

For an example of See
Sending messages using an MS DTC external transaction Visual Basic Code Example: Sending a Message Using an MS DTC External Transaction
Sending messages using an internal transaction Visual Basic Code Example: Sending a Message Using an Internal Transaction

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQCoordinatedTransactionDispenser.BeginTransaction
MSMQTransaction