1

在此处输入图像描述

如图所示,我创建了一个阶梯函数。现在我需要在 StepK 之后执行 StepX(然后 ChoiceA 流程将结束)。所以基本上 StepX 应该像现在一样与 StepY->StepZ 并行执行,但也应该在 StepK 之后执行。但是我找不到访问并行块内的舞台的方法”。有没有办法解决这个问题?

这是我的Json-

{
  "StartAt": "DataPointsExtractor",
  "States": {
    "DataPointsExtractor": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "PathDecider"
    },
    "PathDecider": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.path_type",
          "StringEquals": "ChoiceA",
          "Next": "ChoiceA"
        },
        {
          "Variable": "$.path_type",
          "StringEquals": "ChoiceB",
          "Next": "ChoiceB"
        }
      ],
      "Default": "NoMatchesState"
    },
    "ChoiceA": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "StepK"
    },
    "StepK": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "End": true
    },
    "ChoiceB": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "ParallelStates"
    },
    "ParallelStates": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "StepX",
          "States": {
            "StepX": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "End": true
            }
          }
        },
        {
          "StartAt": "StepY",
          "States": {
            "StepY": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "Next": "StepZ"
            },
            "StepZ": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "End": true
            }
          }
        }
      ],
      "End": true
    },
    "NoMatchesState": {
      "Type": "Fail",
      "Cause": "No Matches!"
    }
  }
}
4

1 回答 1

1

你应该保持简单。由于 ChoiceA 和 ChoiceB 是独立的流,因此它们不需要相交。StepX 可以使用两次(但您必须使用不同的名称)

在此处输入图像描述

定义:

{
  "StartAt": "DataPointsExtractor",
  "States": {
    "DataPointsExtractor": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "PathDecider"
    },
    "PathDecider": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.path_type",
          "StringEquals": "ChoiceA",
          "Next": "ChoiceA"
        },
        {
          "Variable": "$.path_type",
          "StringEquals": "ChoiceB",
          "Next": "ChoiceB"
        }
      ],
      "Default": "NoMatchesState"
    },
    "ChoiceA": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "StepK"
    },
    "StepK": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "StepX"
    },
    "StepX": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "End": true
    },
    "ChoiceB": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:*******",
      "Next": "ParallelStates"
    },
    "ParallelStates": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "StepX",
          "States": {
            "StepX": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "End": true
            }
          }
        },
        {
          "StartAt": "StepY",
          "States": {
            "StepY": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "Next": "StepZ"
            },
            "StepZ": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:*******",
              "End": true
            }
          }
        }
      ],
      "End": true
    },
    "NoMatchesState": {
      "Type": "Fail",
      "Cause": "No Matches!"
    }
  }
}
于 2020-10-07T08:45:26.560 回答