MSMQMessage.TransactionId
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
(Introduced in MSMQ 2.0.) The TransactionId property provides the identifier of the transaction that sent the message.
Data type: | Variant (array of bytes) |
Run-time access: | Read-only |
Property TransactionId As Variant
Parts
messageObject
Message (MSMQMessage) object from queue.
Property Value
A Variant (array of bytes) specifying the 20-byte transaction identifier.
Remarks
The TransactionId property is used by receiving applications to verify that a message was sent as part of a specific transaction. The transaction identifier is a 20-byte identifier that includes the identifier (GUID) of the sending computer (first 16 bits) followed by a 4-byte transaction sequence number.
Transaction identifiers are not guaranteed to be unique because the transaction sequence numbers are not persistent, and they start over again at 2^20. Message Queuing guarantees only that subsequent transactions will have different transaction sequence numbers.
You can use TransactionId along with two transaction boundary properties to verify transaction boundaries. These two properties (MSMQMessage.IsFirstInTransaction and MSMQMessage.IsLastInTransaction) are properties for checking the first and last message sent in a transaction.
When dimensioning arrays for the transaction identifier, always set the lower boundary of the array to 0. When filling in the identifier, Message Queuing sets the lower boundary of the returned byte-array to 0 regardless of what boundary was set by the application.
The following Visual BasicĀ® call will always return 0.
LBound
(msg.TransactionId)
In C++ COM applications, you must use a smart pointer to the IMSMQMessage2 or IMSMQMessage3 interface to expose the TransactionId property.
Equivalent API Function Property
With API function calls, the equivalent property is PROPID_M_XACTID.
For information on | See |
---|---|
How transaction boundaries can be used | Checking for Transaction Boundaries when Receiving Messages |
Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Mqoai.h.
Library: Use Mqoa.lib.