Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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 functions 在持久的编排中使用'if'-'else'结构是否总是*错误的?_Azure Functions_Azure Durable Functions - Fatal编程技术网

Azure functions 在持久的编排中使用'if'-'else'结构是否总是*错误的?

Azure functions 在持久的编排中使用'if'-'else'结构是否总是*错误的?,azure-functions,azure-durable-functions,Azure Functions,Azure Durable Functions,以下if-else结构对于Azure持久功能编排是否太不确定 [FunctionName(FUNC_NAME_ORCH0)] public static async Task<string> RunPlayerYouTubeOrchestration( [OrchestrationTrigger] DurableOrchestrationContext orchestrationContext, ILogger log) { if (!orchestratio

以下
if
-
else
结构对于Azure持久功能编排是否太不确定

[FunctionName(FUNC_NAME_ORCH0)]
public static async Task<string> RunPlayerYouTubeOrchestration(
    [OrchestrationTrigger] DurableOrchestrationContext orchestrationContext,
    ILogger log)
{
    if (!orchestrationContext.IsReplaying)
        log?.LogInformation(GetInvocationMessage(orchestrationContext, FUNC_NAME_ORCH0));

    var hasExhaustedPartitions = await orchestrationContext
        .CallActivityAsync<bool>(FUNC_NAME_ORCH_FUNC0, null);

    if (!hasExhaustedPartitions)
    {
        var jsonBlobs = await orchestrationContext
            .CallActivityAsync<string[]>(FUNC_NAME_ORCH_FUNC1, null);

        var tasks = new Task[jsonBlobs.Length];
        for (int i = 0; i < jsonBlobs.Length; i++)
        {
            var json = jsonBlobs[i];
            tasks[i] = orchestrationContext.CallActivityAsync(FUNC_NAME_ORCH_FUNC2, json);
        }

        if (!orchestrationContext.IsReplaying)
            log?.LogInformation($"{FUNC_NAME_ORCH0}: fan-out starting...");

        await Task.WhenAll(tasks);
    }
    else
    {
        var orc1InstanceId = await orchestrationContext
             .CallSubOrchestratorAsync<string>(FUNC_NAME_ORCH1, null);
        if (!orchestrationContext.IsReplaying)
            log?.LogInformation($"{FUNC_NAME_ORCH1} completed with instance ID `{orc1InstanceId}`.");

        var orc2InstanceId = await orchestrationContext
            .CallSubOrchestratorAsync<string>(FUNC_NAME_ORCH2, null);
        if (!orchestrationContext.IsReplaying)
            log?.LogInformation($"{FUNC_NAME_ORCH2} completed with instance ID `{orc2InstanceId}`.");

        if (!orchestrationContext.IsReplaying)
            log?.LogInformation($"{FUNC_NAME_ORCH_FUNC3}: calling `{PlayerYouTubeIndicesActivity.ProcedureNameResetYouTubePartitionInfoAsync}`...");
        await orchestrationContext
            .CallActivityAsync(FUNC_NAME_ORCH_FUNC3,
                PlayerYouTubeIndicesActivity.GetInput(
                    PlayerYouTubeIndicesActivity.ProcedureNameResetYouTubePartitionInfoAsync));
    }

    return orchestrationContext.InstanceId;
}
[函数名(函数名或函数名)]
公共静态异步任务RunPlayerOutubeOrchestration(
[OrchestrationTrigger]DurableCorchestrationContext orchestrationContext,
ILogger日志)
{
如果(!orchestrationContext.IsReplaying)
日志?.LogInformation(GetInvocationMessage(orchestrationContext,FUNC_NAME_ORCH0));
var hastehustedpartitions=等待编排上下文
.CallActivityAsync(FUNC\u NAME\u ORCH\u FUNC0,null);
如果(!hasExpustedPartitions)
{
var jsonBlobs=await orchestrationContext
.CallActivityAsync(FUNC\u NAME\u ORCH\u FUNC1,null);
var tasks=新任务[jsonBlobs.Length];
for(int i=0;i

hastehustdPartitions
是否与replay配合不好?如果是,则必须执行什么操作?

当评估的条件是确定的时,if/else没有问题。在您的情况下,
FUNC\u NAME\u ORCH\u FUNC0
函数将执行一次,结果将记录在历史记录中,并且记录的结果将用于在所有后续重放中初始化
hastehustedpartitions
变量,因此条件是确定的