I have a requirement where I need to process records from excel. I am using durable functions.Orchestrator client is blob trigger. The Orchestrator function will read blob and trigger activity function asynchronously.Problem that I am facing is activity function is getting re-trigger for few records. Also , it is not processing all of the records.
For example , in excel sheet ,if I have 100 rows , then activity function is getting triggered only 80 times (15 are repeats). Below is the code snippet for Orchestrator function. I have binded blob to orchestrator which is not recommended as per documentation. Is the reason it is causing issue. I am new to Azure and I currently exploring.
[FunctionName("OrchestrationFunction")]
public async Task RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context,
[Blob("input")] CloudBlobContainer container,
ILogger log)
{
log.LogInformation($"Orchestrator triggered : @{DateTime.UtcNow}");
try
{
var accountsProcessing = new List<Task>();
var blobName = context.GetInput<string>();
var blobReference = container.GetBlockBlobReference(blobName);
using var stream = blobReference.OpenRead();
using StreamReader reader = new StreamReader(stream);
//Skip first Line as it is header
reader.ReadLine();
var currentLine = string.Empty;
while ((currentLine = reader.ReadLine()) != null)
{
if (!context.IsReplaying)
{
log.LogInformation($"Data to process : {currentLine}");
Task accountProcess = context.CallActivityAsync<Task>("ProcessRequest",currentLine);
accountsProcessing.Add(accountProcess);
}
}
await Task.WhenAll(accountsProcessing);
}
catch (Exception e)
{
log.LogError($"Exception caught while processing orchestration {e.Message}");
}
}
}