Azure / azure-notificationhubs-dotnet

.NET SDK for Azure Notification Hubs
MIT License
70 stars 119 forks source link

Best practice using with azure functions (socket exceptions) #255

Open michaelmoneypenny opened 1 year ago

michaelmoneypenny commented 1 year ago

Query/Question We are using the SDK from an azure function on a service bus and notice the function sometimes suffers from socket exceptions / SNAT port exhaustion. It seems to be an issue using the SDK in the context of azure functions (our traffic isn't super high)

I've read that the SDK creates a new HTTP client for every request so (from searching online) pass the NotificationHubSettings a message handler created from a factory.

new NotificationHubSettings { MessageHandler = HttpMessageHandlerFactory.CreateHandler() });

I've noticed there is also a HttpClient I can set - should I create a static instance and pass that instead? I'm open to any suggestions!

Why is this not a Bug or a feature Request? I'm looking for best practices to avoid port exhaustion from azure functions

Setup (please complete the following information if applicable):