Both a Topic on the Azure Service Bus and an associated Subscription expose the DefaultMessageTimeToLive property; initialised like so:
if (!NamespaceManager.TopicExists(TopicName))
{
NamespaceManager.CreateTopic(
new TopicDescription(TopicName)
{
MaxSizeInMegabytes = 5120,
DefaultMessageTimeToLive = TimeSpan.FromDays(14)
});
}
if (!NamespaceManager.SubscriptionExists(TopicName, SubscriptionName))
{
NamespaceManager.CreateSubscription(
new SubscriptionDescription(TopicName, SubscriptionName)
{
LockDuration = TimeSpan.FromMinutes(5),
DefaultMessageTimeToLive = TimeSpan.FromDays(7),
EnableDeadLetteringOnMessageExpiration = true
});
}
What is the difference between the two and what is the purpose of having two TTL settings? Furthermore; if a message expires on the Topic what happens to it?