PROPID_M_TIME_TO_BE_RECEIVED

The PROPID_M_TIME_TO_BE_RECEIVED property specifies the total time (in seconds) the message is allowed to live. This includes the time spent getting to its destination queue plus the time spent waiting in the queue before it is retrieved by an application.

Type Indicator
VT_UI4 (or VT_NULL)
PROPVARIANT Field
ulVal
Property Values
Integer value (the default is INFINITE).

Remarks

PROPID_M_TIME_TO_BE_RECEIVED sets the time-to-be-received timer. For a discussion of message timers, see Message Timers. If the timer expires before the message is removed from the queue, MSMQ discards the message, sending it to the dead letter queue if the message's PROPID_M_JOURNAL property is set to MQMSG_DEADLETTER.

MSMQ can also send a return negative acknowledgment message back to the sending application if the message is not removed in time and the message's PROPID_M_ACKNOWLEDGE property is set accordingly.

To set the time-to-be-received timer, pass PROPID_M_TIME_TO_BE_RECEIVED to MQSendMessage.

To find out how much time remains in the time-to-be-received timer, pass PROPID_M_TIME_TO_BE_RECEIVED to MQReceiveMessage and look at the returned value. When passing PROPID_M_TIME_TO_BE_RECEIVED to MQReceiveMessage, the corresponding VT field in the aPropVar array can be set to VT_NULL.

If the time-to-be-received and time-to-reach-queue timers are both specified, the time-to-be-received timer takes precedence over the time-to-reach-queue timer.

MSMQ uses the time-to-be-received timer of the first message when several messages are sent in a transaction. For information on transactions, see MSMQ Transactions.

When MSMQ creates an acknowledgment message, it always sets the message's time-to-be-received timer to INFINITE.

When a message is sent from an independent client computer, the time-to-be-received timer starts ticking as soon as the send operation succeeds, even if the client computer is offline.

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mq.h.
  Import Library: Use mqrt.lib.
  Unicode: Defined only as Unicode.

See Also

MQReceiveMessage, MQSendMessage, PROPID_M_ACKNOWLEDGE, PROPID_M_JOURNAL, PROPID_M_TIME_TO_REACH_QUEUE