This topic has not yet been rated - Rate this topic

BrokeredMessage.TimeToLive Property

Gets or sets the message’s time to live value. This is the duration after which the message expires, starting from when the message is sent to the Service Bus.

Messages older than their TimeToLive value will expire and no longer be retained in the message store. Subscribers will be unable to receive expired messages.

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)
public TimeSpan TimeToLive { get; set; }

Property Value

Type: System.TimeSpan
The message’s time to live value.
Exception Condition
ObjectDisposedException

Thrown if the message is in disposed state.

ArgumentOutOfRangeException

Thrown if the passed in value is less than or equal to TimeSpan.Zero.

The message will be moved to the dead letter queue at TTL expiry if dead lettering is enabled. Otherwise, the message will be discarded from the system. See EnableDeadLetteringOnMessageExpiration and EnableDeadLetteringOnMessageExpiration to learn more about how to control dead lettering setting for Queues and Subscriptions respectively.

If the TTL set on a message by the sender exceeds the destination's TTL, then the message's TTL will be overwritten by the later value. See DefaultMessageTimeToLive, DefaultMessageTimeToLive and DefaultMessageTimeToLive to learn more about how to control message TTL at an entity level.

Did you find this helpful?
(1500 characters remaining)