Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure持久功能,意外值为'IsReplaying'标志_Azure_Function - Fatal编程技术网

Azure持久功能,意外值为'IsReplaying'标志

Azure持久功能,意外值为'IsReplaying'标志,azure,function,Azure,Function,我试图理解Azure持久功能的行为。特别是关于如何重播Orchestrator函数。我以为我已经掌握了窍门,直到我发现Context.IsReplaying标志的一个值对我来说毫无意义 我的代码很像hello world。它有一个Orchestrator函数,可以逐个调用两个活动函数 [FunctionName("OrchestratorFn")] public static async Task<object> Orchestrator( [Orchestr

我试图理解Azure持久功能的行为。特别是关于如何重播Orchestrator函数。我以为我已经掌握了窍门,直到我发现Context.IsReplaying标志的一个值对我来说毫无意义

我的代码很像hello world。它有一个Orchestrator函数,可以逐个调用两个活动函数

[FunctionName("OrchestratorFn")]
    public static async Task<object> Orchestrator(
        [OrchestrationTrigger] IDurableOrchestrationContext context,
        ILogger log
        ) {
        log.LogInformation($"--------> Orchestrator started at {T()}, isReplay={context.IsReplaying}");

        string name = context.GetInput<string>();

        string name1 = await context.CallActivityAsync<string>("A_ActivityA", name);
        string name2 = await context.CallActivityAsync<string>("A_ActivityB", name1);

        log.LogInformation($"--------> Orchestrator ended at {T()}, isReplay={context.IsReplaying}");

        return new {
            OutputFromA = name1,
            OutputFromB = name2
        };
    }


    [FunctionName("A_ActivityA")]
    public static async Task<object> ActivityA(
        [ActivityTrigger] string input,
        ILogger log
        ) {
        log.LogInformation($"--------> Activity A started at {T()}");

        await Task.Delay(3000);
        log.LogInformation($"--------> Activity A ended at {T()}");

        return input + "-1";
    }


    [FunctionName("A_ActivityB")]
    public static async Task<object> ActivityB(
        [ActivityTrigger] string input,
        ILogger log
        ) {
        log.LogInformation($"--------> Activity B started at {T()}");

        await Task.Delay(3000);
        log.LogInformation($"--------> Activity B ended at {T()}");

        return input + "-2";
    }
我无法解释的是最后一行的“isReplay=False”。为什么会这样?isReplay不应该是“真的”吗

我使用的是Microsoft.Azure.WebJobs.Extensions.Durable v2.1.1

否,它不应该是isReplay=true,因为此行实际上只执行一次。每当编排器等待某个调用时,它都会立即停止自己的执行,并等待该调用完成。当它这样做时,它会再次运行所有代码,直到最后一点,而不会再次进行出站调用


由于您的上一条日志语句后面没有进一步的等待,因此此行只到达一次。

谢谢您的解释,您是对的。我假设IsReplaying在每次调用Orchestrator时只设置一次,并且从不更改。现在很清楚,值在Orchestrator中的不同点上发生变化。
[1/26/2020 12:56:40 PM] ------> DurableClient Function Running at 56.40.8424.
[1/26/2020 12:56:49 PM] ------> DurableClient Function END at 56.49.5029.
[1/26/2020 12:57:03 PM] ------> Orchestrator started at 57.03.7915, isReplay=False
[1/26/2020 12:57:04 PM] ------> Activity A started at 57.04.1905
[1/26/2020 12:57:07 PM] ------> Activity A ended at 57.07.2016
[1/26/2020 12:57:24 PM] ------> Orchestrator started at 57.24.8029, isReplay=True
[1/26/2020 12:57:40 PM] ------> Activity B started at 57.40.4136
[1/26/2020 12:57:43 PM] ------> Activity B ended at 57.43.4258
[1/26/2020 12:57:53 PM] ------> Orchestrator started at 57.53.1490, isReplay=True
[1/26/2020 12:57:59 PM] ------> Orchestrator ended at 57.59.0736, isReplay=False