Gets the identifier for the transaction of which the message was a part.
[Visual Basic] Overridable Public ReadOnly Property TransactionId As String [C#] public string TransactionId {virtual get;} [C++] public: __property virtual String* get_TransactionId(); [JScript] public function get TransactionId() : String;
The identifier for the transaction associated with the message. The default is an empty string ("").
Exception Type | Condition |
---|---|
InvalidOperationException | The message queue is filtered not to read the TransactionId property. |
TransactionId provides access to the TransactionId property of the Message Queuing MSMQMessage object.
TransactionId 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 of the sending computer (first 16 bits) followed by a 4-byte transaction sequence number.
Note This property is available only for Message Queuing 2.0 and later.
Transaction identifiers are not guaranteed to be unique because 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 IsFirstInTransaction and IsLastInTransaction to verify transaction boundaries.
Message Class | Message Members | System.Messaging Namespace | IsFirstInTransaction | IsLastInTransaction | Transactional