将AWS步骤功能任务与输出合并到一个数组中

时间:2020-07-31 15:21:38

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

我的任务状态输出以下内容:

"batch": {
    "batch": "size",
    "currentTimestamp": 1596205376
  },

并且地图状态输出将输出一个数组:

"batch": [
    {
      "batch": "product-batch-0",
      "currentTimestamp": 1596205376
    },
    {
      "batch": "product-batch-1",
      "currentTimestamp": 1596205376
    }
]

我想将它们组合起来,以便输入到映射状态之后的状态是这样的:

  "batch": [
    {
    "batch": "Size",
    "currentTimestamp": 1596205376
    },
    {
      "batch": "product-batch-22",
      "currentTimestamp": 1596205376
    },
    {
      "batch": "product-batch-8",
      "currentTimestamp": 1596205376
    }
]

使用aws步骤功能中可用的输入/输出处理是否可能?我想将它们包含在一个数组中,以便稍后可以在状态机中以其他映射状态一起处理它们。

1 个答案:

答案 0 :(得分:0)

您应该使用另一个Lambda函数合并输入和输出,因为步进函数输出功能无法将结果附加到数组中或将输入和输出合并为数组。

[1]:https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultpath.html#input-output-resultpath-append