使用 Map 类型启动状态机的执行
Using Map type to start an execution of state machine
我正在尝试使用 AWS 步函数映射类型为映射的每个项目启动状态机的执行。它不起作用,我找不到任何示例。有这方面的支持吗?如果是这样,谁能告诉我我做错了什么。
"Batch": {
"Type": "Map",
"InputPath": "$.batch", // this will contain an array of 20 files to be processed
"MaxConcurrency": 0,
"Iterator": {
"StartAt": "BatchProcess",
"States": {
"BatchProcess": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"Files.$": "$.batch.Files"
},
"StateMachineArn": "my-state-machine-arn"
},
"ResultPath": "$.batch",
"OutputPath": "$.batch.Output",
"Next": "Done"
}
}
},
"ResultPath": "$.batch",
"OutputPath": "$.batch.Output",
"Next": "next-lambda-function-after-all-files-in-batch-are-processed"
},
基于文档:
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html
您应该使用 ItemsPath
,而不是 InputPath
来指向您的数组。
我正在尝试使用 AWS 步函数映射类型为映射的每个项目启动状态机的执行。它不起作用,我找不到任何示例。有这方面的支持吗?如果是这样,谁能告诉我我做错了什么。
"Batch": {
"Type": "Map",
"InputPath": "$.batch", // this will contain an array of 20 files to be processed
"MaxConcurrency": 0,
"Iterator": {
"StartAt": "BatchProcess",
"States": {
"BatchProcess": {
"Type": "Task",
"Resource": "arn:aws:states:::states:startExecution.sync:2",
"Parameters": {
"Input": {
"Files.$": "$.batch.Files"
},
"StateMachineArn": "my-state-machine-arn"
},
"ResultPath": "$.batch",
"OutputPath": "$.batch.Output",
"Next": "Done"
}
}
},
"ResultPath": "$.batch",
"OutputPath": "$.batch.Output",
"Next": "next-lambda-function-after-all-files-in-batch-are-processed"
},
基于文档: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html
您应该使用 ItemsPath
,而不是 InputPath
来指向您的数组。