amazon-web-services - 如何将输入传递给多个 ARN(aws step 函数)?

标签 amazon-web-services aws-lambda aws-step-functions

我正在尝试弄清楚如何将多个输入传递到我的 ARN。然而,我似乎不能那样做。

下面是我的机器规范

{
    "StartAt": "DemoStateFunction",
    "Version": "1.0",
    "States": {
        "DemoStateFunction": {
            "Type": "Task",
            "Resource": "ARN-Demo-Function",
            "InputPath": "$.demostate1",
            "Next": "DemoStateFunction2"
        },
        "DemoStateFunction2": {
            "Type": "Task",
            "Resource": "ARN-Demo-Function",
            "InputPath": "$.demostate2",
            "End": true         
        }
    }
}

这是我的输入

{
    "demostate1": {
        "data": "john",
    },
    "demostate2": {
        "data": "doe"
    }
}

执行此任务时。它成功地检索了我的 demonstate1 数据,但是它似乎看不到我在“TaskStateEntered”步骤中看到的 demostate2。

最佳答案

机器状态数据从一种状态传递到另一种状态。

如果您从任务返回数据并且没有在您的状态上指定 ResultPath 属性,则任务的输出将成为下一个状态的输入。这是您的 demostate2 丢失的地方。

发件人:http://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-input-output-processing.html

the task results are sent along as the state's output (which becomes the input for the next task).

因此,您需要通过在您的 DemoStateFunction 状态上使用类似这样的内容,将 DemoStateFunction 的结果合并到输入数据中:

    "DemoStateFunction": {
        "Type": "Task",
        "Resource": "ARN-Demo-Function",
        "InputPath": "$.demostate1",
        "ResultPath": "$.demooutput1",
        "Next": "DemoStateFunction2"
    },

这会获取任务的结果并将其合并到 demooutput1 属性下的现有输入结构中。

关于amazon-web-services - 如何将输入传递给多个 ARN(aws step 函数)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47927312/

相关文章:

mysql - 在 AWS RDS MySQL 数据库之间传输数据

amazon-web-services - 如何根据从哪个存储库部署特定 Lambda 来添加它们的设置?

java - 不支持 AWS SAM CLI java8 运行时

amazon-web-services - 具有 "own"资源参数的 AWS::IAM::策略定义

amazon-web-services - 在stepfunctions状态机中仅从$$.Execution.StartTime中提取日期

node.js - 如何使用 Node JS 连接 Redshift 数据库

amazon-web-services - CloudFormation WaitCondition 需要公共(public)访问

amazon-web-services - 在 AWS Cloud Formation 模板中创建嵌套 If else

amazon-web-services - CORS 击败 AWS LAMBDA :(

java - 从 AWS Step Functions Activity 名称获取 ARN