在 Express Step Function 中执行 AWS Express Step Function

AWS Express Step Function execution within Express Step Function

Standard Workflow 中,我们可以愉快地使用

调用另一个 Standard workflow
{
  "Type": "Task",
  "Resource": "arn:aws:states:::states:startExecution.sync:2",
  "Parameters": {
    "StateMachineArn": "${NestedStateMachineArn}",
    ...
  }
  ...

当我们尝试对 Express workflow 做同样的事情时,我们当然会得到 Express state machine does not support '.sync' service integrationaws 表示这是预期的行为。

是否有另一种方法可以从另一个 Express workflow 执行 Express workflow 并以某种方式执行 result/output?我可以想到最后的手段 - 使用 Lambda 函数来执行嵌套的工作流同步并等待响应,也就是说,它会增加不必要地等待 StateMachine 的函数的成本。

我试着环顾四周,但在任何地方都找不到这个记录。

您可以执行另一个工作流程,只是等不及结果了。我相信您只需要从资源中删除 .sync 。如果您需要等待第二个函数的结果,您将无法在快速工作流程中执行此操作。

来自Service Integrations with AWS Step Functions

Standard Workflows and Express Workflows support the same set of service integrations but do not support the same integration patterns. Express Workflows do not support Run a Job (.sync) or Wait for Callback (.waitForTaskToken). For more information, see Standard vs. Express Workflows.

您可以使用 "Resource": "arn:aws:states:::aws-sdk:sfn:startSyncExecution" 在 Step Functions 中使用 StartSyncExecution API, which is now supported as an AWS SDK integration 同步执行 Express 执行。

"NestedExpressWorkflow": {
  "Type": "Task",
  "Resource": "arn:aws:states:::aws-sdk:sfn:startSyncExecution",
  "Parameters": {
    "StateMachineArn": <your_express_state_machine>,
    "Input.$": "$"
  },
  "Next": "NextState"
}