How to update the Registration Time To Live for a Hotification Hub?

David 1 Reputation point
2022-06-06T07:43:09.943+00:00

I would like to update the Registration Time to Live (registrationTtl) property of a Notification Hub.
When I create a new notification hub the registrationTtl is automatically set to TimeSpan.MaxValue which basically means that the registrations will be stored forever.

208616-image.png

I would like to fine tune that value. I have tried to set the value via Azure Portal and via Azure CLI without success.

It is possible to update the Registration Time to Live of a Notification Hub?

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
383 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2022-06-07T15:41:51.647+00:00

    Thanks for reaching here! As its mentioned in the document here:

    "Unless customized, we default the hub Time To Live to the system max DateTime value. So it is correct to be seeing a “Registrations Time To Live” display in the classic Azure portal of 10M+ days if you created that notification hub recently.

    To take advantage of this expiry change, simply update your notification hub’s Time To Live property. This can be done through REST or our .NET SDK:

    var namespaceManager = NamespaceManager.CreateFromConnectionString("connectionstring");  
    NotificationHubDescription hub = namespaceManager.GetNotificationHub("foo");  
    hub.RegistrationTtl = TimeSpan.MaxValue;  
    namespaceManager.UpdateNotificationHub(hub);  
    

    Let us know if further query or issue remains.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.