导出 (0) 打印
全部展开

TimeToLive 属性

注:本页面内容可能不完全适用中国大陆地区运营的 Windows Azure服务。如要了解不同地区 Windows Azure 服务的差异, 请参考本网站.

获取或设置消息的生存时间值。这是消息过期之前的持续时间,从消息发送到服务总线开始计算。

超过 TimeToLive 值的消息将会过期,不再保留在消息存储中。订户无法接收过期的消息。

TimeToLive 是消息可获得的最长生存时间,但其值不能超过在目标队列或订阅上指定 DefaultMessageTimeToLive 值的实体。如果指定的 TimeToLive 值较小,则会将该值应用于各个消息。但是,如果消息上指定了较大的值,该值将由实体的 DefaultMessageTimeToLive 值覆盖。

命名空间:  Microsoft.ServiceBus.Messaging
程序集:  Microsoft.ServiceBus(在 Microsoft.ServiceBus.dll 中)

public TimeSpan TimeToLive { get; set; }

属性值

类型:System..::..TimeSpan
消息的生存时间值。

异常条件
ObjectDisposedException

如果消息处于已释放状态,则会引发此异常。

ArgumentOutOfRangeException

如果传入的值小于或等于 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.

If there are no receive operations on a queue or subscription, the MessageCount property may include messages for which TimeToLive has expired. When a receive operation is called on the queue, the expired messages will not be delivered and the MessageCount property will be updated appropriately.

There is no minimum or maximum bound on TimeToLive.

社区附加资源

添加
显示:
© 2014 Microsoft