Azure functions Azure持久功能中未激发Orchestrator

Azure functions Azure持久功能中未激发Orchestrator,azure-functions,azure-eventgrid,azure-durable-functions,Azure Functions,Azure Eventgrid,Azure Durable Functions,我们在blob存储中创建了很多文件,因此我们将这些文件传递给azure函数。然而,使用Azure函数和事件网格触发器,它在处理了一定数量的文件后超时。因此,现在我尝试使用持久功能 下面是我试过的代码 ProcessJob\u事件网格被触发。但是,ProcessJob\u编排器从未被触发。有什么东西我遗漏了吗 我对持久功能的概念完全陌生 [FunctionName("ProcessJob_Orchestrator")] public async Task Run

我们在blob存储中创建了很多文件,因此我们将这些文件传递给azure函数。然而,使用Azure函数和事件网格触发器,它在处理了一定数量的文件后超时。因此,现在我尝试使用持久功能

下面是我试过的代码

ProcessJob\u事件网格被触发。但是,ProcessJob\u编排器从未被触发。有什么东西我遗漏了吗

我对持久功能的概念完全陌生

[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());
        }
[FunctionName(“ProcessJob\u Orchestrator”)]
公共异步任务RunOrchestrator(
[OrchestrationTrigger]IDurableCorchestrationContext,ILogger日志)
{
log.LogInformation($“****************************正在执行**********************”)的RunOrchestrator方法;
var data=context.GetInput();
LogInformation($“文件名为{data}”);
////将“hello”替换为持久活动函数的名称。
//Add(wait context.CallActivityAsync(“MCNDataTransformation_Hello”,“Tokyo”);
//Add(wait context.CallActivityAsync(“MCNDataTransformation_Hello”,“Seattle”);
//Add(wait context.CallActivityAsync(“MCNDataTransformation_Hello”,“London”));
////返回[“你好东京!”、“你好西雅图!”、“你好伦敦!”]
//返回输出;
}
[功能名称(“MCNDataransformation_Hello”)]
公共字符串SayHello([ActivityTrigger]字符串名称,ILogger日志)
{
log.LogInformation($“向{name}打招呼”);
return$“Hello{name}!”;
}
[FunctionName(“ProcessJob\u EventGrid”)]
公共静态异步void EventGridTest([EventGridTrigger]EventGridEvent,[DurableClient]IDurableOrchestrationClient starter,ILogger日志)
{
JObject objData=JObject.Parse(eventGridEvent.Data.ToString());
//函数输入来自请求内容。
string instanceId=wait starter.StartNewAsync(“ProcessJob_Orchestrator”,null,JsonConvert.SerializeObject(objData));
log.LogInformation(eventGridEvent.Data.ToString());
}

我是持久功能开发团队的成员:) 没有什么事情会立刻被认为是错的。但是,将
null
作为第二个参数传递给
StartNewAsync
有点可疑:除非您试图调用特定的instanceId,否则您没有理由指定该值

你试着把那句话改写成:

// Do not specify instanceId argument if not needed.
string instanceId = await starter.StartNewAsync("ProcessJob_Orchestrator", JsonConvert.SerializeObject(objData));
也许这样就可以了。如果有,请告诉我

如果这不能解决您的问题,那么您可以采取一些后续步骤

  • 在此处本地签出预编译示例: 在那里,试着运行一个简单的编排,比如
    HelloSequence
    。如果您设法运行它,请尝试修改它以适合您的用例

  • 如果上述建议都不起作用,请在中打开一张罚单,我们将立即对此进行检查


  • 您是否尝试将真实实例ID传递给StartNewSync调用?我不认为实例ID可以为null。我传递null的唯一原因是它期望的参数是实例ID。传递null的唯一原因是第二个参数期望的实例ID,所以我将其传递为null,但如果我将其删除,则会出现以下错误------------------------------------------2020-11-26T07:27:55.995[错误]已执行“ProcessJob\u EventGrid”(失败,Id=6f1fefbe-c9e7-4550-8b47-7969226b39dc,持续时间=18ms)instanceId(参数“业务流程实例Id不得包含/、\、\、?、或控制字符)。我尝试了以下三种组合。string instanceId=await starter.StartNewAsync(“HelloWorld”);string instanceId=await starter.StartNewAsync(“HelloWorld”,JsonConvert.SerializeObject(objData));--错误字符串instanceId=await starter.StartNewAsync(“HelloWorld”,null,JsonConvert.SerializeObject(objData));您使用的是Microsoft.Azure.WebJobs.Extensions.DurableTask的哪个版本?另外,您是否能够在本地运行上面列出的示例?Microsoft.Azure.WebJobs.Extensions.DurableTask的版本为2.1.1。您提供的示例是针对Httptrigger的,它已经对我起作用了。然而,对于事件触发器来说,是编排不会被触发的问题。我明白了,我明白你的意思。请考虑在这里打开一个问题:我会通知团队的其他成员,试图找到它的底部!