0

I have an blob triggered function which processes the file by parsing the file and inserting/updating the contents into a DB Table. This works perfectly fine until there are more than is one blob in the container and the function tries to process them concurrently. I end up getting Primary Key constraints (as I should), duplicates etc.

The question is, given there may be more than one blobs in the container at any one time, how can I ensure that each of them is processed sequentially?

thanks

Parag
  • 1
  • 2

1 Answers1

0

According to Microsoft-Documentation it says,

Because the blob trigger operates on a queue, the maximum number of concurrent function invocations is determined by the configurationof queues in host.json. The default settings limit concurrent invocations to 24. This restriction applies to each function that employs a blob trigger separately.

One of the alternative for blob triggers is using Event Grid Trigger. For High scaling the function, concurrency and for minimising latency Event Grid is more useful than Blob Trigger.

References:

c# 4.0 - Concurrency problem with Azure Blob Storage function - Stack Overflow

How to ensure only one Azure Function BlobTrigger runs at a time? - Microsoft Q&A

RithwikBojja
  • 5,069
  • 2
  • 3
  • 7
  • so in my host,json file the batchSize is already set to 1 "queues": { "maxPollingInterval": 30000, "visibilityTimeout": "00:00:30", "batchSize": 1, "maxDequeueCount": 5, "newBatchThreshold": 1 } but the function still processes the file in parallel – Parag Jun 29 '22 at 16:41