Related to my previous question - link
I have created a Durable job with HttpStart in order to call it via http request (code from sample code from MSDN).
In my Durable job, I wrote logic to loop and call an activity trigger 600 times.
public static async Task<List<BusinessRules.RuleResponse>> Run(
[OrchestrationTrigger] DurableOrchestrationContext context)
{
var data = await context.CallActivityAsync<BusinessRules.CustomersData>("XmlDeserialiser");
var tasks = new List<Task<BusinessRules.RuleResponse>>();
for (int i = 0; i < 600; i++)
{
tasks.Add(context.CallActivityAsync<BusinessRules.RuleResponse>("Rule1", data));
// tasks.Add(context.CallActivityAsync<BusinessRules.RuleResponse>("Rule2", data));
// tasks.Add(context.CallActivityAsync<BusinessRules.RuleResponse>("Rule2", data));
}
await Task.WhenAll(tasks);
var result = tasks.Select(x => x.Result).ToList();
return result;
}
The activitytrigger does is just delay for 10 ms and then return object.
[FunctionName("Rule1")]
public static async Task<BusinessRules.RuleResponse> Run(
[ActivityTrigger] BusinessRules.CustomersData data)
{
await Task.Delay(10);
return new BusinessRules.RuleResponse()
{
IsValid = true,
RuleName = "Rule1"
};
}
Idea behind this exercise is my Durable function should be executing 600 business validation rules for each request it receives.
The job status is always coming back as "Running" when I execute the above function with 600 loop. If change the loop count to 500, its working without any problem and returns the result. I tested this on my local machine and on Azure. Its the same in both the environments. However, in my local machine, I found that the job gets completed and I could get the debug point hit in my Durablefunction at return result;
but the status is always displaying as "running".
It looks like Durable functions completed the job but for some reason the data wasnt logged in to the Azure storage tables and hence status is still running.
Please advise.