Events and serverless functions

Serverless functions mainly use events to trigger their invocation. While the following invocation is useful for testing and debugging purposes, it is not really useful for other purposes. Serverless functions excel when they are run on demand and, in general, as part of some automation triggered by events. Calling them manually, as we are doing in the following code, is useful only for testing and debugging purposes:

kubeless function call hello --data 'Hello world!' -n serverless

To be really useful, we need the ability to trigger it through events. One of the easiest ways to integrate our serverless functions with events is to use Azure Event Hubs. In this section, we will integrate Azure Event Hubs with our serverless functions. We will be using Azure Functions to call our serverless function.

There are multiple ways that a function can be linked to Event Hub. Event Grid is also an option. Please see https://docs.microsoft.com/en-us/azure/event-grid/custom-event-quickstart if you would like to take this route.

The following sections will cover these topics:

  • How to create the Azure Function via the portal
  • How to modify the code to call our serverless function
..................Content has been hidden....................

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