共用方式為


MessagePropertyFilter.TransactionId 屬性

定義

取得或設定值,指出在接收或窺視訊息時是否要擷取 TransactionId 屬性資訊。

public:
 property bool TransactionId { bool get(); void set(bool value); };
[System.Messaging.MessagingDescription("MsgTransactionId")]
public bool TransactionId { get; set; }
[<System.Messaging.MessagingDescription("MsgTransactionId")>]
member this.TransactionId : bool with get, set
Public Property TransactionId As Boolean

屬性值

true 表示接收 TransactionId 資訊,否則為 false。 預設為 false

屬性

範例

下列程式代碼範例示範 如何使用 TransactionId 屬性。

// Set the queue's MessageReadPropertyFilter property 
// to enable the message's TransactionId property.
queue->MessageReadPropertyFilter->TransactionId = true;

// Peek at the message. Time out after ten seconds 
// in case the message was not delivered.
orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0));

// Display the value of the message's 
// TransactionId property.
Console::WriteLine("Message.TransactionId: {0}", 
    orderMessage->TransactionId);
// Set the queue's MessageReadPropertyFilter property to enable the
// message's TransactionId property.
queue.MessageReadPropertyFilter.TransactionId = true;

// Peek at the message. Time out after ten seconds in case the message
// was not delivered.
orderMessage = queue.Peek(TimeSpan.FromSeconds(10.0));

// Display the value of the message's TransactionId property.
Console.WriteLine("Message.TransactionId: {0}",
    orderMessage.TransactionId);

備註

類別 TransactionIdMessage 屬性會識別傳送訊息的交易。 在接收應用程式內使用這個屬性,確認訊息已傳送為特定交易的一部分。

適用於

另請參閱