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();
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. |
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.
MessageQueue Class | MessageQueue Members | System.Messaging Namespace | CommitTransaction | RollbackTransaction | Transactional