【发布时间】:2019-08-03 09:26:13
【问题描述】:
我在 AWS 上使用步进函数。考虑由 lambda 组成的状态机:
"StartAt": "Metadata",
"States": {
"Metadata": {
"Type": "Task",
"Resource": "${metadataArn}",
"Next": "StoreMetadata",
"Retry" : [
{
"ErrorEquals": [ "States.All" ],
"IntervalSeconds": 2,
"MaxAttempts": 3
}
],
"Catch": [
{
"ErrorEquals": [ "States.All" ],
"Next": "ErrorHandler"
}
]
} ...
...
如何将特定数据传递给“ErrorHandler”。例如,失败的步骤,可能是一条数据。我正在使用 nodejs,但可以推断到任何运行时。
例如,在节点中,我们可能有一个 lambda,其中:
module.exports.handler = async input => {
const ids = JSON.parse(input).ids
// try to read in data for ids.
// read fails / throws exception
}
如何让错误处理程序获取 id 数组以便我可以将它们标记为失败?如果这个“ErrorHandler”是多个步骤的问题,我怎么知道哪些步骤失败了?
【问题讨论】:
标签: amazon-web-services aws-lambda aws-step-functions