Updated: July 19, 2016

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The MaxTimeToReachQueue property of the MSMQMessage object specifies a time limit (in seconds) for the message to reach the queue.

Data type:Long
Run-time access:Read/write
Property MaxTimeToReachQueue As Long  

An integer value (the default is the enterprise-wide setting for the time-to-reach-queue interval).

MaxTimeToReachQueue is used to set the message's time-to-reach-queue timer. For a discussion of message timers, see Message Timers. If the time-to-reach-queue interval elapses before the message reaches its destination, Message Queuing discards the message, sending it to the dead-letter queue if the message's MSMQMessage.Journal property is set to MQMSG_DEADLETTER.

Message Queuing can also send a return negative acknowledgment message back to the sending application if the message does not arrive and the message's MSMQMessage.Ack property is set accordingly.

If this property is not set or if this property is set to LONG_LIVED or INFINITE, Message Queuing uses the enterprise-wide setting for the time-to-reach-queue interval.

This enterprise-wide setting can be adjusted by the MSMQ Administrator. By default, this setting equals 4 days for messages sent from the following types of computers:

  • Computers running MSMQ 3.0 in workgroup mode.

  • Clients running MSMQ 3.0 that belong to a completely new Windows domain.

  • Clients running MSMQ 3.0 that join an existing domain provided weakened security was not enabled for that forest.

In each hop, Message Queuing subtracts the time elapsed from MaxTimeToReachQueue when it dispatches the message to the next computer, where a new timer is set. Once a message arrives at the queue, MaxTimeToReachQueue can be used to find out how much time remains in the time-to-reach-queue timer. A value of 0 indicates the specified time interval has elapsed.

Message Queuing uses two message timers: time-to-reach-queue and time-to-be-received. If the time-to-be-received timer is set to a value less than the time-to-reach-queue timer, the time-to-be-received timer takes precedence over the time-to-reach-queue timer.

No matter what value MaxTimeToReachQueue is set to (even if it is set to 0), Message Queuing always gives each message one chance to reach its destination. All the computers on the way and the queue are in a ready state. If the queue is local, the message always reaches the queue.

When several messages are sent in a transaction, Message Queuing automatically uses the time-to-reach-queue timer of the first message. For more information, see Transactions.

When Message Queuing creates an acknowledgment message, it always sets the message's time-to-reach-queue time interval to LONG_LIVED.

When a message is sent from an independent client computer, the time-to-reach-queue timer starts ticking as soon as the send operation of the sending application succeeds, even if the client computer is offline.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_TIME_TO_REACH_QUEUE.

Windows and Windows Server: Included in Windows Vista, Windows Server 2008, and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.