AWS Step Functions-将输入传递给另一个任务 [英] AWS Step Functions - Pass input to another task
问题描述
如何在AWS Step Functions中的 task
中将输入传递给输出?
How can I pass my input to my output in a task
in AWS Step Functions?
我知道了这个问题,以及文档:
如果ResultPath的值为null,则意味着该州自己的原始输出将被丢弃,其原始输入将成为其结果.
If the value of ResultPath is null, that means that the state’s own raw output is discarded and its raw input becomes its result.
但是我需要的是:
- 输入我的信息
{
"input": "my_input"
}
- 我的lambda输出
{
"output": "my_output"
}
我需要将以下json传递到下一个状态:
I need to pass to the next state the following json:
{
"input": "my_input",
"output": "my_output"
}
推荐答案
Two suggestions comes to mind, either Use ResultPath to Replace the Input with the Result, which allows you to
如果未指定ResultPath,则默认行为类似于您已指定
"ResultPath":"$"
.因为这告诉状态用结果替换整个输入,所以状态输入完全由任务结果中的结果替换.
If you don't specify a ResultPath, the default behavior is as if you had specified
"ResultPath": "$"
. Because this tells the state to replace the entire input with the result, the state input is completely replaced by the result coming from the task result.
要使此选项起作用,Lambda函数必须返回所需的响应:
For this option to work, the Lambda function must return the desired response:
{
"input": "my_input",
"output": "my_output"
}
或者在Step Functions开发人员指南中>使用ResultPath将结果包含在输入中.接下来,如果您将Lambda的返回值更改为仅包含"my_output"
,则可以指定"ResultPath":"$ .output"
以获得所需的结果:
Alternatively Use ResultPath to Include the Result with the Input in the Step Functions developer guide. Next, if if you change the return value from you Lambda to include just "my_output"
you can specify "ResultPath": "$.output"
to achieve the desired result:
{
"input": "my_input",
"output": "my_output"
}
这篇关于AWS Step Functions-将输入传递给另一个任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!