AWS步骤功能-将输入传递给另一个任务

问题描述 投票:0回答:1

如何在AWS Step Functions中将输入传递到task中的输出?

我知道this question和文档:

如果ResultPath的值为null,则意味着该州自己的原始输出将被丢弃,其原始输入将成为其结果。

但是我需要的是:

  • 提供我的意见
{
  "input": "my_input"
}
  • 和我的lambda输出
{
  "output": "my_output"
}

我需要将以下json传递到下一个状态:

{
  "input": "my_input",
  "output": "my_output"
}
amazon-web-services aws-step-functions
1个回答
0
投票

[有两个建议出现,Use ResultPath to Replace the Input with the Result,允许您执行以下操作

如果未指定ResultPath,则默认行为类似于您已指定"ResultPath": "$"。因为这告诉状态用结果替换整个输入,所以状态输入将完全由任务结果中的结果替换。

为了使此选项起作用,Lambda函数必须返回所需的响应:

{
  "input": "my_input",
  "output": "my_output"
}

或者在[Step Functions]开发人员指南中为Use ResultPath to Include the Result with the Input。接下来,如果您将Lambda的返回值更改为仅包含"my_output",则可以指定"ResultPath": "$.output"以实现所需的结果:

{
  "input": "my_input",
  "output": "my_output"
}
© www.soinside.com 2019 - 2024. All rights reserved.