Muokkaa

Jaa


Message.TransactionId Property

Definition

Gets the identifier for the transaction of which the message was a part.

public:
 property System::String ^ TransactionId { System::String ^ get(); };
[System.Messaging.MessagingDescription("MsgTransactionId")]
public string TransactionId { get; }
[<System.Messaging.MessagingDescription("MsgTransactionId")>]
member this.TransactionId : string
Public ReadOnly Property TransactionId As String

Property Value

The identifier for the transaction associated with the message.

Attributes

Exceptions

The message has not been sent. This property can only be read on messages retrieved from a queue.

-or-

The message queue is filtered to ignore the TransactionId property.

Examples

The following code example displays the value of a message's TransactionId property.

Remarks

Receiving applications use the TransactionId property to verify that a message was sent as part of a specific transaction. The transaction identifier contains the identifier of the sending computer (first 16 bits) followed by a 4-byte transaction sequence number.

This property is available only for Message Queuing version 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 the TransactionId property along with the IsFirstInTransaction and IsLastInTransaction properties to verify transaction boundaries.

Applies to

See also