Azure Functions:
Introduction: This article is a continuation of the series of
articles starting with the description of SignalR service which was followed by a discussion on Azure
Gateway service, Azure
Private Link, and Azure Private Endpoint and the benefit of diverting traffic
to the Azure Backbone network. Then we started reviewing a more public
internet-facing service such as the Bing API. and the benefits it provided when used together with
Azure Cognitive Services. We then discussed infrastructure API such as Provider
API, ARM resources, and Azure
Pipeline and followed it up with a brief
overview of the Azure services support for Kubernetes Control Plane via the
OSBA and Azure operator. Then we followed it with an example of Azure
integration service for Host Integration Server (HIS). We started discussing the Azure FHIR service next. We were reviewing its search capabilities, followed by its regulatory compliance and security
policies. Most recently, we discussed Azure
Synapse link for Cosmos DB.
This article talked about connecting all Azure functionalities via extensions
that do not affect existing deployments with the help of Azure Functions.
Specifically, we discuss sending emails from Azure Function using a
Notification Hub Binding.
Description: The Notification Hub Output Binding for Azure functions
enables us to send push notifications by using Azure Notification Hubs. Azure
functions support output bindings for Notification Hubs. There are many
languages to choose from for writing the Azure function, but in all these
choices, the Notification Hub must be configured for the Platform Notification
Service. We can get the push notifications in the client application from
Notification Hub.
Templates can be
used with notifications which enable a client application to specify the exact
format of the notifications it wants to receive. This helps with a platform
agnostic backend, personalized notifications, client-version independence, and
easy localization. A notification using
template registration contains a message placeholder in the template.
For example:
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
public static void Run(string myQueueItem, out IDictionary<string, string>
notification, TraceWriter log)
{
log.Info($"C# Queue trigger function processed:
{myQueueItem}");
notification =
GetTemplateProperties(myQueueItem);
}
private static IDictionary<string, string>
GetTemplateProperties(string message)
{
Dictionary<string, string> templateProperties = new
Dictionary<string, string>();
templateProperties["message"] = message;
return
templateProperties;
}
No comments:
Post a Comment