如何在等待任务令牌步骤和下一步中保留输入数据

huangapple go评论43阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年4月7日 03:31:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/75953129.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定