Export (0) Print
Expand All

Message.TimeToBeReceived Property

Gets or sets the maximum amount of time for the message to be received from the destination queue.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

[MessagingDescriptionAttribute("MsgTimeToBeReceived")]
public TimeSpan TimeToBeReceived { get; set; }

Property Value

Type: System.TimeSpan
The total time for a sent message to be received from the destination queue. The default is InfiniteTimeout.

ExceptionCondition
InvalidOperationException

The message queue is filtered to ignore the TimeToBeReceived property.

ArgumentException

The value specified for TimeToBeReceived is invalid.

The TimeToBeReceived property specifies the total time for a sent message to be received from the destination queue. The time limit includes the time spent getting to the destination queue and the time spent waiting in the queue before the message is received.

Caution noteCaution

When using dependent client computers, be sure the clock on the client computer is synchronized with the clock on the server that is running Message Queuing. Otherwise, unpredictable behavior might result when sending a message whose TimeToBeReceived property is not InfiniteTimeout.

If the interval specified by the TimeToBeReceived property expires before the message is removed from the queue, Message Queuing discards the message in one of two ways. If the message's UseDeadLetterQueue property is true, the message is sent to the dead-letter queue. If UseDeadLetterQueue is false, the message is ignored.

You can set the message's AcknowledgeType property to request that Message Queuing send a negative acknowledgment message back to the sending application if the message is not retrieved before the timer expires.

If the value specified by the TimeToBeReceived property is less than the value specified by the TimeToReachQueue property, TimeToBeReceived takes precedence.

When several messages are sent in a single transaction, Message Queuing uses the TimeToBeReceived property of the first message.

The following code example gets and sets the value of a message's TimeToBeReceived property.

// Set the message's TimeToBeReceived property to five minutes.
orderMessage.TimeToBeReceived = TimeSpan.FromMinutes(5.0);

// Display the new value of the message's TimeToBeReceived property.
Console.WriteLine("Message.TimeToBeReceived: {0}",
    orderMessage.TimeToBeReceived.ToString());

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft