typescript 如何从AWS CDK中的新StepFunctionsStartExecution接收响应?

2ic8powd  于 2023-02-25  发布在  TypeScript
关注(0)|答案(1)|浏览(133)
    • 使用案例:**

1.Map阶跃函数1中的子项
1.将每个JSON对象发送到步骤函数2
1.在步骤功能2结束时,它接收来自第三方API的响应
1.在阶跃函数1中使用该API响应

    • 图片:**

    • 代码:**
this.mapOverChildren = new Map(this, "Map Over Children", {
  itemsPath: "$.data.children",
  maxConcurrency: 1,
  resultPath: "$.children",
});

this.mapOverChildren .iterator(new StepFunctionsStartExecution(this, 'Send Data to Step Function 2', {
  stateMachine: stepFunction.Two,
  integrationPattern: IntegrationPattern.REQUEST_RESPONSE,
  resultPath: "$.stepFunctionTwoResponse"
});

此时,resultPath仅显示有关阶跃函数执行的信息。如何从阶跃函数2取回数据?

    • 结果路径:**
{
    "ExecutionArn": "xxxxxxxxxxxx",
    "SdkHttpMetadata": {
      "AllHttpHeaders": {
        "x-amzn-RequestId": [
          "xxxxxxxxxxx"
        ],
        "Content-Length": [
          "000"
        ],
        "Date": [
          "Thu, 23 Feb 2023 11:24:14 GMT"
        ],
        "Content-Type": [
          "application/xxxxxxxxxxxxxxxxxxxxxxx"
        ]
      },
      "HttpHeaders": {
        "Content-Length": "111",
        "Content-Type": "application/xxxxxxxxxxxxxxxxxxxxxxx",
        "Date": "Thu, 23 Feb 2023 11:24:14 GMT",
        "x-amzn-RequestId": "xxxxxxxxxxxxxxxxxxxxxxx"
      },
      "HttpStatusCode": 200
    },
    "SdkResponseMetadata": {
      "RequestId": "xxxxxxxxxxxxxxxxxxxxxxx"
    },
    "StartDate": 1677151454840
  }
nhaq1z21

nhaq1z211#

https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html
REQUEST_RESPONSE是错误的积分模式,如果您想等待子步骤函数完成并使用其结果,请改用RUN_JOB

相关问题