从另一个分支访问 AWS Step 函数中并行块内的阶段

Accessing a stage inside the parallel block in an AWS Step function from another branch

我已经创建了一个阶跃函数,如图所示。现在我需要在 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!"
    }
  }
}

你应该保持简单。由于 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!"
    }
  }
}