【问题标题】:AWS Step Function - Is it possible to get the original input after using InputPath $.something?AWS Step Function - 使用 InputPath $.something 后是否可以获得原始输入?
【发布时间】:2021-08-24 10:03:42
【问题描述】:

我的情况是我有 2 个任务处于并行状态。我们使用 SNS,需要“MessageAttributes”字段通过 DL 队列重新处理消息。

我发送给步进函数的输入是:

{
  "Body": { "Message": "This is the body" },
  "MessageAttribtutes": "These are the message attributes"
}

并行状态中的任务有一个“InputPath: $.Body”,所以任务的输入是

{
  "Message": "This is the body"
}

它们还有一个“ResultPath: null”,因此它们返回原始输入。

但是并行状态的输出是

 {
    "Message": "This is the body"
 },
 {
    "Message": "This is the body"
 }

有没有办法让状态的输出变成这样?

 {
    "Body": { "Message": "This is the body" },
    "MessageAttribtutes": "These are the message attributes"
 },
 {
   "Body": { "Message": "This is the body" },
   "MessageAttribtutes": "These are the message attributes"
 }

这是我的 Step Function 定义:

{
 "StartAt": "Process Videos",
  "States": {
    "Process Videos": {
      "Type": "Parallel",
      "Next": "Finalizer",
      "InputPath": "$.Body",
      "Branches": [
        {
          "StartAt": "GPS Parser",
          "States": {
            "GPS Parser": {
              "Type": "Task",
              "Resource": "x",
              "ResultPath": null,
              "End": true
            }
          }
        },
        {
          "StartAt": "Video Creator",
          "States": {
            "Video Creator": {
              "Type": "Task",
              "Resource": "x",
              "ResultPath": null,
              "End": true
            }
          }
        }
      ]
    },
    "Finalizer": {
      "Type": "Task",
      "Resource": "x",
      "End": true
    },
    "ErrorHandler": {
      "Type": "Task",
      "Resource": "x",
      "End": true
    }
  }
}

【问题讨论】:

    标签: aws-step-functions


    【解决方案1】:

    问题在于对 InputPath 的误解:$.Body。 我从 Parallel 状态中删除了 InputPath 并将其放入并行状态中的 2 个状态,它工作了

    【讨论】:

      猜你喜欢
      • 2017-12-23
      • 1970-01-01
      • 2020-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-01
      • 2022-10-23
      • 2016-07-19
      相关资源
      最近更新 更多