问题
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:
- Just use two different paths for processed and not processed blobs.
- 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