Robert Riley
Robert Riley

Reputation: 406

Azure Functions Blob Trigger Alternative

I'm trying to create a bit of serverless architecture and I have a concern about using an Azure Function on a blob trigger.

I have Azure Function 1 that is a Queue Trigger that gets a message to run a request to an API that generates a file and places it in blob storage, the function does not wait for a response. Then I would like to have created an Azure Function 2 that will send that blob/link to a second place. However I was reading about how a blob trigger is not guaranteed to trigger for every blob, I believe "best effort" is the phrase they use in the docs.

My second idea given the "best effort" issue was to have the first function wait for a response and place a message in the queue for a new version of the second function, using a queue trigger instead of a blob trigger. enter image description here

I'm wondering if this is worth the trade off of making the Queue Trigger 1 wait for a response, and if the "best effort" risk worth the change. Or if there is a better design out there I'm happy to hear it.

Upvotes: 0

Views: 1498

Answers (1)

kavya Saraboju
kavya Saraboju

Reputation: 10871

Thanks for the suggestion @peter bons

You may use Event Grid instead of the Blob storage trigger to get notifications whenever something is changed for the following scenarios: • Blob storage accounts • High scale • Minimizing cold-start delay

It has built-in support for events coming from storage blobs and resource groups. For that we need to create a event grid subscription , need storage account and function app endpoint .

Steps :

  1. Login to Azure portal and create an endpoint

  2. Create a Function App So, for creating an endpoint, we will use Function App with trigger type as Azure Event Grid Trigger. enter image description here

  3. In the storage account that you have(if not create one) ,create even grid subscription .

enter image description here

  1. To monitor when a file is uploaded to Azure storage , select Event Type as Blob Created.

enter image description here

  1. Add function app details by clicking on selecting the endpoint.

enter image description here

Upload file in blob and notice the notifications .

See this for more details

Other references:

  1. Azure Event Grid bindings for Azure Functions
  2. Automate resizing uploaded images using Event Grid

Upvotes: 1

Related Questions