Is it possible to ensure an Azure Function executes only once in parallel?
I have the requirement to execute an Azure Function (let's call it OperationalFunction) only once in parallel. What I mean is the following:
I have two "entry point" functions:
- I have a BlobTrigger Function (BlobTriggeredStartFunction)
- I have a HttpTrigger Function (HttpTriggeredStartFunction)
Both of those functions call an orchestrator function (OrchestratorFunction) like this:
string instanceId = await starter.StartNewAsync(nameof(OrchestrationFunction),null,data);
This orchestration function has the following code:
[FunctionName("OrchestrationFunction")]
public async Task OrchestrationFunction(
[OrchestrationTrigger] IDurableOrchestrationContext context){
var input = context.GetInput<string>();
await context.CallActivityAsync(nameof(OperationalFunction),input);
}
I want that the OperationalFunction is executed ONLY ONCE in parallel, so that if I receive multiple triggers (n blob/http-triggered events), the OperationalFunction at a certain time, is executing only one instance, when such instance finishes, then the new event in the queue (FIFO) is executed.
Which is the best approach to that?