NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MessageQueue.BeginTransaction

Creates a new Message Queuing internal transaction context.

[Visual Basic]
Public Sub BeginTransaction()
[C#]
public void BeginTransaction();
[C++]
public: void BeginTransaction();
[JScript]
public function BeginTransaction();

Exceptions

Exception Type Condition
InvalidOperationException The transaction has already been started.
MessageQueueException The attempt to get information about the queue generated an exception specified by the given status.

Remarks

BeginTransaction marks the start of processing that will be committed or rolled back, depending on the success of the transaction. If an exception occurs during processing, the entire transaction will be rolled back. This includes messages sent after the call to BeginTransaction. Messages that are part of a transaction must be sent to transactional queues.

You should make a call to BeginTransaction within a Try...Catch block. The call to CommitTransaction should be within the Try clause. Insert the call to RollbackTransaction into the Catch clause.

Example

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | CommitTransaction | RollbackTransaction | Transactional