Creating the function

Now that we have a Service Bus Queue set up, we are ready to create an Azure Function to receive the messages from the queue.

To create the function, execute the following steps:

  1. To do so in Visual Studio, right-click on TextEvaluation project and click on Add -> New Item -> Azure Function and add a ProcessQueue function.
  2. Fill in the required parameters as follows:
    • Type: ServiceBusQueueTrigger
    • Access rights: Listen
    • FunctionName: ProcessQueue
    • Connection: serviceBus
    • Queue name: emailqueue (lowercase)
  3. Click on Create.
  4. Add the setting for the Service Bus connection string to the root level ListenPolicy to local.settings.json:
        "serviceBus": "Endpoint=sb://textsentimentsb.servicebus .windows.net/;SharedAccessKeyName=ListenPolicy; ...

Get Serverless computing in Azure with .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.