Message.TimeToReachQueue 屬性


取得或設定訊息抵達佇列的最大時間量。Gets or sets the maximum amount of time for the message to reach the queue.

 property TimeSpan TimeToReachQueue { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan TimeToReachQueue { get; set; }
public TimeSpan TimeToReachQueue { get; set; }
member this.TimeToReachQueue : TimeSpan with get, set
member this.TimeToReachQueue : TimeSpan with get, set
Public Property TimeToReachQueue As TimeSpan



從傳送訊息開始至訊息到達目的地佇列的時間限制。The time limit for the message to reach the destination queue, beginning from the time the message is sent. 預設為 InfiniteTimeoutThe default is InfiniteTimeout.



篩選訊息佇列以忽略 TimeToReachQueue 屬性。The message queue is filtered to ignore the TimeToReachQueue property.

針對 TimeToReachQueue 指定的值無效。The value specified for TimeToReachQueue is invalid. 可能表示負數。It might represent a negative number.


下列程式碼範例會取得並設定訊息屬性的值 TimeToReachQueueThe following code example gets and sets the value of a message's TimeToReachQueue property.


如果屬性指定的間隔在 TimeToReachQueue 訊息抵達目的地之前過期,則訊息佇列會以兩種方式的其中一種來捨棄訊息。If the interval specified by the TimeToReachQueue property expires before the message reaches its destination, Message Queuing discards the message in one of two ways. 如果訊息的 UseDeadLetterQueue 屬性是 true,訊息就會傳送到寄不出的信件佇列。If the message's UseDeadLetterQueue property is true, the message is sent to the dead-letter queue. 如果 UseDeadLetterQueuefalse ,則會忽略訊息If UseDeadLetterQueue is false, the message is ignored

您可以設定訊息的 AcknowledgeType 屬性,要求訊息佇列將負認可訊息傳送回傳送端應用程式(如果訊息未在計時器到期之前到達)。You can set he message's AcknowledgeType property to request that Message Queuing send a negative acknowledgment message back to the sending application if the message does not arrive before the timer expires.

如果 TimeToReachQueue 屬性設定為0秒,則訊息佇列會嘗試將訊息傳送至其目的地的一次,如果佇列正在等候訊息,則為。If the TimeToReachQueue property is set to 0 seconds, Message Queuing tries once to send the message to its destination - if the queue is waiting for the message. 如果佇列是本機佇列,訊息一律會到達它。If the queue is local, the message always reaches it.

如果屬性指定的值 TimeToReachQueue 大於屬性所指定的值 TimeToBeReceived ,則 TimeToBeReceived 會優先使用。If the value specified by the TimeToReachQueue property is greater than the value specified by the TimeToBeReceived property, TimeToBeReceived takes precedence.

在單一交易中傳送數個訊息時,訊息佇列會使用 TimeToReachQueue 第一個訊息的屬性。When several messages are sent in a single transaction, Message Queuing uses the TimeToReachQueue property of the first message.