Task Explanation:
- Iterate through the children in Step Function 1
- Forward each JSON object to Step Function 2
- Upon completion of Step Function 2, a response is obtained from an external API
- Utilize this API response within Step Function 1
Visual Representation:
https://i.stack.imgur.com/3Jho2.png
Code Example:
this.iterateChildren = new Iterate(this, "Iterate Children", {
itemsPath: "$.data.children",
maxConcurrency: 1,
resultPath: "$.children",
});
this.iterateChildren.iterator(new ForwardToExternalAPI(this, 'Send Data to Step Function 2', {
stateMachine: stepFunction.Two,
integrationPattern: IntegrationPattern.REQUEST_RESPONSE,
resultPath: "$.stepFunctionTwoResponse"
});
Currently, the resultPath
only displays details about the step function execution. How can I retrieve data back from Step Function 2?
Data Output Path:
{
"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
}