When a new or updated blob is detected, the Azure function is triggered.
As stated in the Azure documentation, several methods exist to execute a function code based on changes to blobs in a storage container. The Azure Blob storage trigger for Azure Functions may only be appropriate only for some cases, as detailed in Working with Blobs. This should only be used when the blob is small.
First, read HowTo: Create a GeneXus Procedure to be deployed as an Azure or AWS Function.
To deploy the function, use the deployment tool. See HowTo: Deploy as Azure Functions.
The Trigger type property in the deployment unit should be "Blob" for this kind of function.
At the Blob Connection App Settings section of the deployment dialog, you should set the following:
- Name: A name for the Azure cloud application setting containing the connection to the Blob Storage. It can already be defined in the cloud, or not. If not, you can use the deployment to create the app setting if you give a value to it at the following property.
- Value: Optionally give a value for the app setting that should contain the connection string of the Blob Storage. The deployment engine will create the app setting using this information.
At the Blob Storage Properties section of the deployment dialog, you should set the Blob Path.
The Blob Path indicates the Blob storage container and should include a name pattern. It can be a generic pattern like the following (between curly braces):
...or it could be a more complex pattern as detailed in the documentation.
The GeneXus procedure will have a signature as explained in HowTo: Create a GeneXus Procedure to be deployed as an Azure or AWS Function.
In this case, the EventMessage SDT will contain the following in each of its fields:
- EventMessageId: The invocationId of the Azure Function
- EventMessageSourceType: Blob
- EventMessageVersion: ""
- EventMessageDate: Date and time of execution
- EventMessageData: A String containing the file created / updated. If it's a binary file, it will contain the base 64 encoded string.
- EventMessageProperties: Properties and Metadata of the Blob, including:
- Uri: The blob's URI for the primary location.
- name: The name of the file including its extension.
This functionality is available since GeneXus 18 Upgrade 5.