Compartir a través de


Message Timers

 

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

Message Queuing provides two timers to help you maintain better control of your messages: a time-to-reach-queue and a time-to-be-received timer.

The time-to-reach-queue timer (which is set according to the time specified in the PROPID_M_TIME_TO_REACH_QUEUE or MSMQMessage.MaxTimeToReachQueue property of the message) determines how long a message has to reach the queue manager of the target computer. Typically, this timer is set to a value less than the time-to-be-received setting (PROPID_M_TIME_TO_BE_RECEIVED or MSMQMessage.MaxTimeToReceive).

The time-to-be-received setting determines how long a message remains in the system, starting from the time the message is sent to the time it is removed from the destination queue.

In each hop, Message Queuing subtracts the time elapsed on the applicable computer from the time-to-reach-queue and time-to-be-received properties of the message when it dispatches the message to the next computer, where a new timer is set.

When both timers are used and the time-to-be-received timer is set to a smaller value than the time-to-reach-queue timer, the time-to-be-received timer takes precedence. For example, if the time-to-be-received timer is set to 3 minutes and the time-to-reach-queue timer is set to 10 minutes, Message Queuing will discard the message after 3 minutes. A message is not allowed to remain in the system longer than the time specified by the time-to-be-received timer.

When a timer expires, Message Queuing discards the message. However, Message Queuing can also place the discarded message in the applicable dead-letter queue or it can send a negative acknowledgment message to an administration queue.

Discarded messages can be placed in dead-letter queues if the journaling level (PROPID_M_JOURNAL or MSMQMessage.Journal) of the messages is set to MQMSG_DEADLETTER. Nontransactional messages are placed in the dead-letter queue on the computer where the time-to-reach-queue timer expires. Copies of transactional messages are placed in the transactional dead-letter queue on the source computer.

Acknowledgment messages are returned if a timer expires and the acknowledgment level of the message specifies full or negative acknowledgments. Message Queuing sends the appropriate negative acknowledgment message to the administration queue specified by the message.

When a message is sent over an HTTP transport, the relative time specified in the time-to-be-received property of the message is converted to the absolute UTC date and time until which the message may be stored in the destination queue and is inserted into the header portion of the SOAP envelope.

More Information

For information on See
Message property used to set the time-to-reach-queue timer and its default value PROPID_M_TIME_TO_REACH_QUEUE
Message property used to set the time-to-be-received timer and its default value PROPID_M_TIME_TO_BE_RECEIVED
COM message property used to set the time-to-reach-queue timer and its default value MSMQMessage.MaxTimeToReachQueue
COM message property used to set the time-to-be-received timer and its default value MSMQMessage.MaxTimeToReceive
The <TTrq> element used to specify the time-to-be-received in an HTTP message Properties Mapped to Elements of the MSMQ Namespace
Placing discarded messages in dead-letter queues Dead-Letter Queues
Requesting acknowledgment messages Acknowledgment Messages
Options for sending messages Sending Messages

Examples

For an example of See
Sending messages that request acknowledgments C/C++ Code Example: Requesting Acknowledgment Messages

 Visual Basic Code Example: Requesting Acknowledgment Messages