在Azure持久功能中未触发Orchestrator [英] Orchestrator is not fired in Azure Durable Function

查看:87
本文介绍了在Azure持久功能中未触发Orchestrator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在blob存储中创建了许多文件,因此,我们将这些文件传递给了azure函数.但是,如果使用Azure功能和事件网格触发器,则在确定为否之后会超时.的文件已处理.因此,现在我正在尝试使用持久功能.

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.

下面是我尝试的代码.

ProcessJob_EventGrid被触发.但是,ProcessJob_Orchestrator永远不会被触发.有什么我想念的吗?

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

推荐答案

我是Durable Functions开发人员小组的成员:)没有什么立即脱颖而出的.但是,将 null 作为第二个参数传递给 StartNewAsync 有点可疑:除非您尝试调用特定的instanceId,否则没有理由指定值.

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. 在此处本地检出预编译的示例:

  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.

如果以上任何建议均不起作用,请在中打开票证https://github.com/Azure/azure-functions-durable-extension/issues ,我们将立即进行查看!

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!

这篇关于在Azure持久功能中未触发Orchestrator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆