Export (0) Print
Expand All

Message.TimeToReachQueue Property

Gets or sets the maximum amount of time for the message to reach the queue.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

[MessagingDescriptionAttribute("MsgTimeToReachQueue")]
public TimeSpan TimeToReachQueue { get; set; }

Property Value

Type: System.TimeSpan
The time limit for the message to reach the destination queue, beginning from the time the message is sent. The default is InfiniteTimeout.

ExceptionCondition
InvalidOperationException

The message queue is filtered to ignore the TimeToReachQueue property.

ArgumentException

The value specified for TimeToReachQueue is invalid. It might represent a negative number.

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. If the message's UseDeadLetterQueue property is true, the message is sent to the dead-letter queue. If UseDeadLetterQueue is false, the message is ignored

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.

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.

If the value specified by the TimeToReachQueue property is greater than the value specified by the TimeToBeReceived property, TimeToBeReceived takes precedence.

When several messages are sent in a single transaction, Message Queuing uses the TimeToReachQueue property of the first message.

The following code example gets and sets the value of a message's TimeToReachQueue property.

// Set the message's TimeToReachQueue property to five minutes.
orderMessage.TimeToReachQueue = TimeSpan.FromMinutes(5.0);

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

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft