3

I have to register bindings in Functions v2 to use them. This can be done, for example, as adding corresponding NuGet package. Azure's docs says that Notification Hubs bindings are not available for Functions v2. However, I still can add that Nuget package (Microsoft.Azure.WebJobs.Extensions.NotificationHubs) in Visual Studio. Will it just not work? Should I stick to Functions v1 to be able to send notifications? Or is there any new way to send them with Functions v2?

Ingweland
  • 1,073
  • 1
  • 13
  • 25

2 Answers2

2

It's not a high priority work item for us at the moment, but we have some base work done on migrating the Notification Hubs binding to the Functions v2 runtime. A developer who wants to use Notification Hubs in Functions v2 today has two options:

  1. Go bindingless and integrate with Notification Hubs via their SDK.
  2. Clone the aforementioned branch of the extensions repo. Building it will give you a NuGet package that can be referenced like any other extension from your project. Note: You will have to deploy the build artifacts for the NuGet reference to work properly.

(We're also open source and welcome community contributions!)

Katy Shimizu
  • 1,051
  • 5
  • 9
0

As Version 1.x is in maintenance mode and Notification Hubs binding continues to be Version 1.x only, I think the best way forward is to use Azure Functions Version 2.x (or 3.x) and access the Notification Hubs via their SDK, as Katy mentioned above.

I've found this sample official Azure project helpful to get you started (the configuration is very minimal): https://github.com/Azure/azure-notificationhubs-dotnet/tree/master/Samples/AzFunctions

See the SendPushSample and other samples in parent folders for specific use cases.

You lose the clear indication what is an output of an Azure Function, but only for notifications. And given all the improvements in Version 2.x and up (and the fact that it's actively maintained), it seems like a worthy trade-off.

Igor Klimer
  • 15,321
  • 3
  • 47
  • 57