传递输入到AWS Step Functions中的输出 [英] Passthrough input to output in AWS Step Functions

查看:68
本文介绍了传递输入到AWS Step Functions中的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在AWS Step Functions中将输入传递到Task状态到输出?

How can I passthrough the input to a Task state in an AWS Step Functions to the output?

在阅读InputPath,ResultPathOutputPath的各种组合.

After reading the Input and Output Processing page in the AWS docs, I have played with various combinations of InputPath, ResultPath and OutputPath.

状态定义:

"First State": {
    "Type": "Task",
    "Resource": "[My Lambda ARN]",
    "Next": "Second State",
    "InputPath": "$.someKey",
    "OutputPath": "$"
}

输入:

{
    "someKey": "someValue"
}

预期结果

我希望First State的输出(以及Second State的输入)是

I would like the output of the First State (and thus the input of Second State) to be

{
    "someKey": "someValue"
}

实际结果

[empty]


如果输入更为复杂,例如


What if the input is more complicated, e.g.

{
    "firstKey": "firstValue",
    "secondKey": "secondValue"
}

我想转发所有内容而不必担心(子)路径.

I would like to forward all of it without worrying about (sub) paths.

推荐答案

Amazon States Languages中指出:

如果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.

因此,我将状态定义更新为

Consequently, I updated my state definition to

"First State": {
    "Type": "Task",
    "Resource": "[My Lambda ARN]",
    "Next": "Second State",
    "ResultPath": null
}

结果,当传递输入示例Task时,输入有效负载也将被复制到输出中,即使对于像这样的丰富对象也是如此:

As a result, when passing the input example Task input payload will be copied to the output, even for rich objects like:

{
    "firstKey": "firstValue",
    "secondKey": "secondValue"
}

这篇关于传递输入到AWS Step Functions中的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆