Earlier this month, Microsoft added support for their serverless event driven platform, Azure Functions, within the Azure IoT Gateway SDK. This addition provides a cloud-based extensibility point for developers building IoT solutions on top of Azure.
The Azure IoT Gateway SDK was originally launched, in beta, at the Hannover Messe event in April of this year. The Azure IoT Gateway SDK, written in ANSI C, is a cross-platform framework that allows for extensibility at the IoT gateway level. This extensibility allows for different types of devices, including non-TCP/IP devices, to communicate with the cloud by using a variety of high level languages including Node, Java and C#. The gateway is then able to communicate with Microsoft’s Azure IoT Hub which enables bi-directional communication between devices and Microsoft’s cloud.
Azure Functions are Microsoft’s entry into serverless computing. Nir Mashkowski, principal group program manager at Microsoft describes Azure Functions as “an event driven, compute-on-demand experience that extends the existing Azure application platform with capabilities to implement code triggered by events occurring in Azure or third party service as well as on-premises systems.” Developers are able to write these functions in a variety of languages including JavaScript, C#, Python and PHP. These functions may expose an HTTP endpoint or use pre-defined triggers such as Blob Storage, Event Hub or WebHook.
By adding Azure Functions support into the Azure IoT Gateway SDK, Microsoft is introducing new capabilities for developers building IoT applications. It also provides a centralized location for cloud-based logic to be executed, as opposed to running and deploying that code on all of your devices. Sam George, partner director for Azure IoT, describes a scenario for calling Azure Functions from the Azure IoT Gateway SDK: “if something goes wrong in your field gateway environment, such as local devices that can’t connect or misbehave, and you want to upload diagnostic information to your Azure IoT solution for inspection by operations, our new Functions integrations make this simple. Just create an Azure Function that takes this data, stores it and alerts operations – and then call it from your gateway running the Azure IoT Gateway SDK when you encounter a problem.”
Communication within the IoT Gateway occurs through the use of modules. Therefore, executing an Azure Function is achieved by calling it from a module within the gateway. Modules are able to exchange data with each other by exchanging messages over a message bus using pub/sub or other messaging patterns. Modules can also be used for protocol mediation, message format conversion, filtering and communication to the cloud. Within the Azure IoT Gateway SDK, Microsoft has provided some prewritten modules but has also included interfaces, so that developers can also create their own module.
Image Source: https://github.com/Azure/azure-iot-gateway-sdk/blob/develop/doc/getting_started.md