How can we prevent an azure function from processing already processed blob?

房东的猫 提交于 2020-01-05 04:15:12

问题


I have an azure function, which is binded to blob storage. Once the blob is successfully processed I rename the file with a suffix '-Processed'.

But my azure function again picks up the same blob for processing. I tried putting {name}.csv filter in the BlobTrigger binding but that didn't help as the file will still be a csv even after the rename.

I know I can filter blobs to have a particular string in file name, for eg "original-{name}" will filter files starting with original. But Is there a way in azure functions using which I can filter the blob names to not include a particular string, in my case '-Processed'?


回答1:


  1. Just use two different paths for processed and not processed blobs.
  2. Put your new blobs with prefix ("notprocessed-" for example), when renaming remove prefix. Set "path": "input/notprocessed-{name}"



回答2:


Actually, blob service only supports filtering by blob prefix and not by suffix. Your only option would be to list blobs and then do client side filtering.

Also, the list blobs operation has an additional delimiter parameter that enables the caller to traverse the blob namespace by using a user-configured delimiter.

You could refer to this article for more details.



来源:https://stackoverflow.com/questions/50434530/how-can-we-prevent-an-azure-function-from-processing-already-processed-blob

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!