Amazon SWF 并行子工作流执行暂停父工作流
Amazon SWF Parallel Child Workflow Executions Halt Parent Workflow
我正在尝试使用不同的启动参数启动子工作流的两个并行执行。但是,我注意到这些子工作流执行中只有一个是 运行。父工作流执行由于任务未被安排而停止,这导致在执行历史记录中没有任何进一步的 activity,直到它超时。没有异常或错误被抛出,它只是停止做任何事情。有趣的是,它始终是第二个子工作流执行完成。
如果父 运行 仅执行一次子工作流,则子工作流成功完成,父工作流继续完成。我的怀疑是,它与同时 运行ning 子工作流的多个副本有关,并且它们相互干扰,因为它们轮询相同的任务列表;我只是不知道我应该如何解决这个问题。
代码:
ProcessRunnerClient childWorkflowClient = factory.getClient();
List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
switch(condition){
case 1:
childWorkflowsDone.add(childWorkflowClient.method(case1Params));
// Works fine
break;
case 2:
childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// Works fine
break;
case 3:
childWorkflowsDone.add(childWorkflowClient.method(case1Params));
childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// The execution of the child workflow with case2Params completes,
// and parent execution suspends
break;
default:
throw new WorkflowException("Condition " + condition + " not supported");
}
确保每个子工作流都使用其自己的已生成客户端实例启动。因此,将您的示例更改为:
List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
ProcessRunnerClient childWorkflowClient1 = factory.getClient()
childWorkflowsDone1.add(childWorkflowClient.method(params1));
ProcessRunnerClient childWorkflowClient2 = factory.getClient()
childWorkflowsDone.add(childWorkflowClient2.method(params2));
完成后支持子工作流启动后的通信。例如,同一客户端可用于发送 signal 或检索 runId.
我正在尝试使用不同的启动参数启动子工作流的两个并行执行。但是,我注意到这些子工作流执行中只有一个是 运行。父工作流执行由于任务未被安排而停止,这导致在执行历史记录中没有任何进一步的 activity,直到它超时。没有异常或错误被抛出,它只是停止做任何事情。有趣的是,它始终是第二个子工作流执行完成。
如果父 运行 仅执行一次子工作流,则子工作流成功完成,父工作流继续完成。我的怀疑是,它与同时 运行ning 子工作流的多个副本有关,并且它们相互干扰,因为它们轮询相同的任务列表;我只是不知道我应该如何解决这个问题。
代码:
ProcessRunnerClient childWorkflowClient = factory.getClient();
List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
switch(condition){
case 1:
childWorkflowsDone.add(childWorkflowClient.method(case1Params));
// Works fine
break;
case 2:
childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// Works fine
break;
case 3:
childWorkflowsDone.add(childWorkflowClient.method(case1Params));
childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// The execution of the child workflow with case2Params completes,
// and parent execution suspends
break;
default:
throw new WorkflowException("Condition " + condition + " not supported");
}
确保每个子工作流都使用其自己的已生成客户端实例启动。因此,将您的示例更改为:
List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
ProcessRunnerClient childWorkflowClient1 = factory.getClient()
childWorkflowsDone1.add(childWorkflowClient.method(params1));
ProcessRunnerClient childWorkflowClient2 = factory.getClient()
childWorkflowsDone.add(childWorkflowClient2.method(params2));
完成后支持子工作流启动后的通信。例如,同一客户端可用于发送 signal 或检索 runId.