Run Azure Functions from Azure Stream Analytics

We have learnt about serverless computing on Azure using Azure Functions and Cosmos DB in a previous post. In this post lets see how we can run an Azure Function from an Azure Stream Analytics job.

This can be achieved in the following steps:

Step 1: Create Azure Stream Analytics job: This can be done using the Azure portal UI.

Step 2: Create an Azure Cache for Redis instance: After creating a cache, make a note of the Primary connection string under Access Keys.

Step 3: Create an Azure Function: This will be an HTTP-triggered function. For detailed steps and code for the Azure function, please see the Reference link below this post.

Step 4: Update the Stream Analytics job with the Azure Function as output: In this step, we are just adding Azure Functions as the sink for the Stream Analytics job that we created in Step 1.

The Azure Steam Analytics job should be sending data to the Redis Cache using the Azure Function that we created in Step3.

The HTTP request timeout is set to 100 seconds. This means that if the Azure Function takes more than 100 seconds to process a batch, the Stream Analytics job will error out. But in case this occurs, Azure Stream Analytics is going to retry sending the failed batch to the Azure Function again.

Reference: https://docs.microsoft.com/en-us/azure/stream-analytics/stream-analytics-with-azure-functions#:~:text=You%20can%20run%20Azure%20Functions,Azure%20or%20third%2Dparty%20services.

One thought on “Run Azure Functions from Azure Stream Analytics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: