Orchestrator is not fired in Azure Durable Function

天大地大妈咪最大 提交于 2021-02-11 12:29:09

问题


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());
        }

回答1:


I'm a member of the Durable Functions developer team :) Nothing immediately stands out as being wrong. However, passing null as the 2nd parameter toStartNewAsync is a bit suspicious: unless you're trying to invoke a specific instanceId, there should be no reason for your to specify that value.

How about you try rewriting that line to be:

// Do not specify instanceId argument if not needed.
string instanceId = await starter.StartNewAsync("ProcessJob_Orchestrator", JsonConvert.SerializeObject(objData));

Perhaps that should do it. Please let me know if it does!

If that doesn't fix your problem, there are a few follow-up steps you can take.

  1. Locally check-out the precompiled samples here: https://github.com/Azure/azure-functions-durable-extension/tree/dev/samples/precompiled In there, try running a simple orchestration such as HelloSequence. If you manage to run it, try modifying it to fit your use-case.

  2. If none of the advise above works, open a ticket in https://github.com/Azure/azure-functions-durable-extension/issues and we'll take a look at this promptly!



来源:https://stackoverflow.com/questions/65016637/orchestrator-is-not-fired-in-azure-durable-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!