The documentation on BrokeredMessage says:
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.
So, to achieve messages to be automatically removed from my "Log" subscription, When creating the subscription, I have set the SubscriptionDescription.DefaultMessageTimeToLive
property to TimeSpan.FromDays(5)
.
When I create and send a brokered message, leaving the TimeToLive
property on that message to the default value, when I inspect messages arriving in that the subscription, the ExpiresAtUtc
property for the messages is 31-12-9999 23:59
. and the TimetoLive
property is 10675199.02:48:05.4775807
. Since the TTL on the 'destination' subscription is 5 days, I would have expected a value 5.00:00:00
there.
Is there something else that I need to do to get this working?
Steps to reproduce with Service Bus Explorer 2.2.1.0
- Connect to a Service Bus Namespace on azure
- Create a new topic "MyTopic"
- Create a subscription "Log" under the topic and set the Default Message Time to Live to 5 days.
- Right click on the MyTopic topic node and choose "Send messages"
- On the "Send messages to MyTopic" screen: click "Start"
- Click the "Log" subscription node
- Click the "Messages" button and choose Peek 10
- Click the message in the list
- Look at the TimeToLive field in the "Message Properties" area
Apparenlty the TTL value on peeked messages is meaningless:
This answer was given on this MSDN thread: http://social.msdn.microsoft.com/Forums/windowsazure/en-US/dfe58dbb-186d-4c71-a708-8f6f7267b451/when-peeking-for-messages-the-time-to-live-value-seems-not-to-be-set-is-this-a-bug