Search code examples
azureazure-blob-storageazure-storage-queues

How to Create an Azure Queue Storage Message when a Blob File is Uploaded/Updated?


I am using Azure Storage Explorer to upload blob files into an Azure Storage Account. And would like to send a message to an Azure Storage Queue for every uploaded/updated file.

The message will contain the name of the file. These messages will be used by an Azure Webjob to identify which files to process.

How can this be accomplished? Is there a better way to do it?

Note: I am not using BlobTrigger inside the webjob because there is no guarantee that it will be notified by the trigger (according to the documentation).


Solution

  • Per my experience, BlobTrigger would work as expected in my most cases. As the document you mentioned has stated as follows:

    If the speed and reliability limitations of blob triggers are not acceptable for your application, the recommended method is to create a queue message when you create the blob, and use the QueueTrigger attribute instead of the BlobTrigger attribute on the function that processes the blob.

    As evilSnobu commented that there is no any in-build feature for you to send a message to Storage Queue when uploading blobs via Azure Storage Explorer. Based on your scenario, if you abandon BlobTrigger, I assume that you need to build your Web API or service for client-user to upload the file, then upload the user uploaded files to your Azure Storage and send a message (e.g. filename,etc.) to Storage queue in your back-end by yourself. At this point, the QueueTrigger would be triggered within your WebJob, and you could deal with the file (blob).