PROPID_M_TIME_TO_BE_RECEIVED (Compact 2013)

3/26/2014

This property specifies the total time (in seconds) the message is allowed to live. This includes the time it spends getting to the 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.

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 PROPID_M_JOURNAL property of the message 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 PROPID_M_ACKNOWLEDGE property of the message is set accordingly.

To set the time-to-be-received timer, specify PROPID_M_TIME_TO_BE_RECEIVED in the MQMSGPROPS structure and call MQSendMessage.

To find out how much time remains in the time-to-be-received timer, specify PROPID_M_TIME_TO_BE_RECEIVED in the MQMSGPROPS structure. Then call MQReceiveMessage and examine the returned value.

When specifying PROPID_M_TIME_TO_BE_RECEIVED, you can set its Type Indicator to VT_NULL. When the Type Indicator is set to VT_NULL, MSMQ sets the VT field to the appropriate type indicator.

If the time-to-be-received and time-to-reach-queue timers are 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.

When MSMQ creates an acknowledgment message, it sets the time-to-be-received timer of the message 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.

Examples

The following examples show how PROPID_M_TIME_TO_BE_RECEIVED is specified in the MQMSGPROPS structure for setting and retrieving the time-to-be-received timer. The timer is set to expire in 3 minutes.

To set the time-to-be-received timer

aMsgPropId[i] = PROPID_M_TIME_TO_BE_RECEIVED;
aMsgPropVar[i].vt = VT_UI4; 
aMsgPropVar[i].ulVal = 60*3;
i++;

To retrieve the time-to-be-received timer

aMsgPropId[i] = PROPID_M_TIME_TO_BE_RECEIVED;
aMsgPropVar[i].vt = VT_UI4; 
i++;

Note

OS versions prior to 2.12 require the MSMQ add-on pack.

Requirements

Header

mq.h

See Also

Reference

MSMQ Properties
MQReceiveMessage
MQSendMessage
PROPID_M_ACKNOWLEDGE
PROPID_M_JOURNAL
PROPID_M_TIME_TO_REACH_QUEUE
MQMSGPROPS