We have lots of files that get created in blob storage and consequently we are passing these files to the azure functions. However with Azure function and event grid trigger it was timed out after certain no. of files were processed. Hence now I am trying with durable functions.
Below is the code I tried.
ProcessJob_EventGrid gets triggered. However the ProcessJob_Orchestrator never gets triggered. Is there something that I am missing.
I am completely new to the Durable functions concept.
[FunctionName("ProcessJob_Orchestrator")]
public async Task RunOrchestrator(
[OrchestrationTrigger] IDurableOrchestrationContext context, ILogger log)
{
log.LogInformation($"************** RunOrchestrator method executing ********************");
var data = context.GetInput<string>();
log.LogInformation($"File Name is {data}.");
//// Replace "hello" with the name of your Durable Activity Function.
//outputs.Add(await context.CallActivityAsync<string>("MCNDataTransformation_Hello", "Tokyo"));
//outputs.Add(await context.CallActivityAsync<string>("MCNDataTransformation_Hello", "Seattle"));
//outputs.Add(await context.CallActivityAsync<string>("MCNDataTransformation_Hello", "London"));
//// returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
//return outputs;
}
[FunctionName("MCNDataTransformation_Hello")]
public string SayHello([ActivityTrigger] string name, ILogger log)
{
log.LogInformation($"Saying hello to {name}.");
return $"Hello {name}!";
}
[FunctionName("ProcessJob_EventGrid")]
public static async void EventGridTest([EventGridTrigger] EventGridEvent eventGridEvent, [DurableClient] IDurableOrchestrationClient starter, ILogger log)
{
JObject objData = JObject.Parse(eventGridEvent.Data.ToString());
// Function input comes from the request content.
string instanceId = await starter.StartNewAsync("ProcessJob_Orchestrator", null, JsonConvert.SerializeObject(objData));
log.LogInformation(eventGridEvent.Data.ToString());
}