Share via


MSMQMessage.MaxTimeToReceive (Windows CE 5.0)

Send Feedback

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.

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

Parameters

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

Return Values

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

MaxTimeToReceive sets 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.Journal property is set to MQMSG_DEADLETTER.

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

After a message arrives at the queue, MaxTimeToReceive can 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_RECEIVED message property.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Mqoai.h.
Link Library: Mqoa.lib.

See Also

MSMQMessage | MSMQMessage.Ack | MSMQMessage.Journal | PROPID_M_TIME_TO_BE_RECEIVED

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.