Creating a basic Azure Function to listen for Queue events

Let's create a simple Azure Function to learn how easily it can be developed to read the events from the Storage Queue in Azure.

To start with, we will log in to the Azure portal, and go to the marketplace, and search for Function Apps. The creation of Function App is the first step before creating an Azure Function, and more than one Azure Function can run under a single Function App:

Click to create the Function App, and provide values like AppName, Subscription, Resource Group, Hosting Plan, and so on. Once the Function App is created, we can start adding functions.

Azure Function App provides various function templates, which we can choose from. Choosing any of these templates generates a basic boilerplate code, which you can customize based on your needs. For example, the QueueTrigger-CSharp template can be used to listen for Queue events and add the basic code of reading it from queue, and so on.

Let's choose the QueueTrigger-CSharp template, and create a new function:

Once the function is created, we can use the online code editor to write C# code if C# was selected as the language for that particular template:

We can modify the function, and specify the Trigger events as we did in the WebJobs section. We can also pass JSON content as the Queue messsage, and if the parameter accepts object, it will automatically be serialized and injected to that function. It also provides complete monitoring in terms of logs and the count of functions being accessed with complete information about the function parameter values. To learn more about Azure Functions, please refer to the following link:

https://docs.microsoft.com/en-us/azure/azure-functions/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.138.104