0

I have one storage account. and i want to trigger two azure function when a new file comes with blob trigger. also want to make sure that both azure function will process different blob file.

How to achieve this scenario?

enter image description here

Thanks in Advance..

I want to trigger multiple function for single blob trigger event.

1 Answers1

0

Yes ,It is possible we can trigger multiple function for single blob trigger(STORAGE ACCOUNT> CONTAINER) event.

As we have tried at our end using single storage account (container) and trigger successfully to our two Function app.

For test purpose we have follow the below:

  • Created two Azure function using portal and select our one created storage account for both of the function apps .

  • Added blob trigger function to our function apps.

  • Created container with sample-workitems.

  • Added file to container .

OUTPUT SCREENSHOT FOR REFERENCE:-

Make sure to select one storage account for both of the function: enter image description here

enter image description here

enter image description here

enter image description here

For more information please refer the below links:

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15
  • As I can see in screenshot for the same file container.txt both function got executed. but I want to executed in only one(in case for single file). if multiple files get uploaded at same time then both function will process same file. which I don't want. I want that both function to process different files. – vishnu prajapati Mar 24 '22 at 06:46
  • As per my understanding When you have one container and two function for it and want to trigger both , whenever you will different files added to container then your functions will trigger the same. AFAIK, This is the only way to achieve your requirement as you have mentioned in your question. – AjayKumarGhose Mar 24 '22 at 06:53
  • We can upload multiple files without mentioning any file name while run . Check this blog here :https://kontext.tech/article/776/create-blob-triggered-azure-functions-using-net-5 – AjayKumarGhose Mar 24 '22 at 07:31
  • Hello @vishnuprajapati, Any update on this.. – AjayKumarGhose Mar 29 '22 at 08:19
  • Hello @AjayKumarGhose-MT yes tried with your suggestion but it is not working as per expectation. both function trigger for same blob file. but i want to trigger it for different files. – vishnu prajapati Apr 01 '22 at 06:02
  • AFAIK, if you will upload multiple file at a time then it will show in your logs of function – AjayKumarGhose Apr 01 '22 at 06:19
  • Also please refer this https://stackoverflow.com/questions/71574763/running-blob-storage-trigger-over-existing-files-multiple-times/71584080 – AjayKumarGhose Apr 01 '22 at 06:24
  • As you described in your question you want 2 function trigger with one blob container then , when you will upload your files to that blob obviously it will trigger the blob which you have uploaded . – AjayKumarGhose Apr 01 '22 at 06:26
  • yes correct, if I will upload multiple files then both function will trigger. but suppose I uploaded 2 files at a time named file1 and file2. so I want that one function1 to be process for file1 trigger and function2 will process trigger for file2. but with your suggestion function1 and function2 both are processing file1 and file2. I want to divide the load between functions. – vishnu prajapati Apr 02 '22 at 07:49
  • As you have planned one blob storage with different function , in that kind of scenarios function will trigger only the blobs which are uploaded in both 1 &2 (function logs). If you want configure like the way as mentioned above comment ,Its not possible AFAIK. – AjayKumarGhose Apr 02 '22 at 10:06