Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This property specifies a time limit, in seconds, for the message to be retrieved from the target queue. This includes the time spent getting to the destination queue plus the time spent waiting in the queue before it is retrieved by an application.

Syntax

HRESULT get_MaxTimeToReceive( 
  long* 
plMaxTimeToReceive 
);
HRESULT put_MaxTimeToReceive( 
  long 
lMaxTimeToReceive
);

Parameters

plMaxTimeToReceiveor lMaxTimeToReceive

Time limit, in seconds, for the message to be retrieved from the target queue. The default value is INFINITE.

Return Value

The following table describes the common return values.

Value Description

S_OK

Success

E_INVALIDARG

One or more arguments are invalid

E_NOTIMPL

The function contains no implementation

E_OUTOFMEMORY

Out of memory

Remarks

MaxTimeToReceivesets the message's time-to-be-received timer. If the time-to-be-received timer expires before the message is removed from the queue, Message Queuing discards the message, sending it to the dead-letter queue if the message's MSMQMessage.Journalproperty is set to MQMSG_DEADLETTER.

Message Queuing can also send a negative acknowledgment message to the sending application if the message's MSMQMessage.Ackproperty is set accordingly and the message is not retrieved before the timer expires.

After a message arrives at the queue, MaxTimeToReceivecan be used to find out how much time remains in the time-to-be-received timer.

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.

Message Queuing uses the time-to-be-received timer of the first message when several messages are sent in a transaction.

When Message Queuing creates an acknowledgment message, it 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.

When using dependent client computers, be sure the clock on the client computer is in sync with the clock on the server running MSMQ. If these clocks are not synchronized, you can see unpredictable behavior when sending messages with the time-to-be-received timer set.

Equivalent Function Property

When using function calls, the time-to-be-received timer of the message can be set and retrieved using the PROPID_M_TIME_TO_BE_RECEIVEDmessage property.

Requirements

Header mqoai.h
Library mqoa.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also