Abort
MSMQTransaction

The Abort method terminates the transaction associated with the MSMQTransaction object.

Syntax

object.Abort ([fRetaining][, fAsync])
 
Syntax Element Description
object Transaction (MSMQTransaction) object that identifies the transaction.
fRetaining Optional. Boolean.
fAsync Optional. Boolean.

Remarks

After an abort, all actions taken on the queue are rolled back. For example, if a message is sent to a queue and the transaction is aborted, the messages are not sent to the queue.

Abort is a wrapper for lTransaction::Abort. For information on lTransaction::Abort, see the Microsoft Platform SDK.

Example

This example starts a transaction, sends two messages, and then terminates the transaction.

Dim xdispenser as New MSMQCoordinatedTransactionDispenser
Dim xact as MSMQTransaction

Dim qSend as MSMQQueue                
Dim msg1 as New MSMQMessage
Dim msg2 as New MSMQMessage

Set xact = xdispenser.BeginTransaction
Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
msg1.Label = "MyTransaction message"
msg1.Body = "Message 1 Body"
msg1.Send qSend, xact                     'Associates send with xact.

msg2.Label = "MyTransaction message"
msg2.Body = "Message 2 Body"
msg2.Send qSend, xact                     'Associates send with xact.

xact.Abort                                'Aborts transaction.
 

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mqoai.h.
  Import Library: Use mqoa.lib.
  Unicode: Defined only as Unicode.

See Also

BeginTransaction, Body, Label, Open, Send