Provides a Message Queuing internal transaction.
Assembly: System.Messaging (in System.Messaging.dll)
Thetype exposes the following members.
|Abort||Rolls back the pending internal transaction.|
|Begin||Begins a new Message Queuing internal transaction.|
|Commit||Commits a pending internal transaction.|
|Dispose||Releases all resources used by the .|
|Dispose(Boolean)||Releases the unmanaged resources used by the and optionally releases the managed resources.|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|Finalize||Infrastructure. Releases the resources held by the current instance. (Overrides Object.Finalize.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
To send or receive a message as part of a transaction, you can use the class to create a transaction and pass it to an overload of the MessageQueue.Send method or the MessageQueue.Receive method that takes a transaction parameter. Messages sent as part of a transaction must be sent to transactional queues. Messages received from transactional queues must be received using a specified transaction.
In addition to the Receive method, you can receive messages with a specified identifier or specified correlation identifier. See the ReceiveById and ReceiveByCorrelationId methods for more information about selectively receiving messages from transactional queues.
Messages sent to transactional queues are removed if the transaction is committed. Similarly, messages received from transactional queues are returned to the queue if the transaction is rolled back.
If you instantiate a and pass it to an applicable overload of the Send method or Receive method to send a message to a non-transactional queue or receive a message from a non-transactional queue, the method throws an exception that indicates "Wrong Transaction Usage."
is threading apartment aware, so if your apartment state is STA, you cannot use the transaction in multiple threads. Visual Basic sets the state of the main thread to STA, so you must apply the MTAThreadAttribute in the Main subroutine. Otherwise, sending a transactional message using another thread throws a MessageQueueException exception. You apply the MTAThreadAttribute by using the following fragment.
<System.MTAThreadAttribute> public sub Main()