英文:
How to preserve input data from a waitForTaskToken step to the next step
问题
我有以下的步骤函数:
stepFunctions:
  stateMachines:
    MyStateMachine:
      name: MyStateMachine    
      definition:
        StartAt: StateA
        States:
           StateA:
             Type: Task
             Resource:
               Fn::GetAtt: [LambdaA, Arn]
             Next: StateB
           StateB:
             Type: Task
             Resource: 'arn:aws:states:::lambda:invoke.waitForTaskToken'
             Parameters:
               FunctionName:
                 Fn::GetAtt: [ LambdaB, Arn ]
               Payload:
                 input.$: '$'
                 taskToken.$: '$$.Task.Token'
              TimeoutSeconds: 300
              OutputPath: '$'
            Next: StateC
          StateC:
            Type: Task
            Resource:
              Fn::GetAtt: [LambdaC, Arn]
            End: true
LambdaB 返回了包括生成的任务令牌在内的 StateB 的输入数据。然而,当使用此任务令牌和一些附加数据调用 send-task-token-success 时,StateC 的输入数据只包括与 send-task-token-success 调用一起发送的数据。
是否有办法将 StateB 的输出数据传递到 StateC?
不幸的是,我无法控制与 send-task-token-success 一起发送的数据,我需要在任务令牌生成之前知道在 StateC 中使用了哪些数据。
英文:
I have the following stepfunction:
stepFunctions:
  stateMachines:
    MyStateMachine:
      name: MyStateMachine    
      definition:
        StartAt: StateA
        States:
           StateA:
             Type: Task
             Resource:
               Fn::GetAtt: [LambdaA, Arn]
             Next: StateB
           StateB:
             Type: Task
             Resource: 'arn:aws:states:::lambda:invoke.waitForTaskToken'
             Parameters:
               FunctionName:
                 Fn::GetAtt: [ LambdaB, Arn ]
               Payload:
                 input.$: '$'
                 taskToken.$: '$$.Task.Token'
              TimeoutSeconds: 300
              OutputPath: '$'
            Next: StateC
          StateC:
            Type: Task
            Resource:
              Fn::GetAtt: [LambdaC, Arn]
            End: true 
LambdaB is returning the input data from StateB including the generated Tasktoken.
However when send-task-token-success with this tasktoken and some additional data is called, the input data of StateC is only the data send with the send-task-token-success call.
Is there a way to pass along the output data from StateB to StateC?
Unfortunately I don't have any controll about the data send with the send-task-token-success and I need the information in StateC which data was used before the task token was generated.
答案1
得分: 1
我找到了解决方案。
将ResultPath添加到步骤中即可。
英文:
Well I found the solution.
Adding ResultPath to the step does the trick
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论