【问题标题】:Detail field from Step Functions gets stringified in EventBridgeStep Functions 的详细信息字段在 EventBridge 中被字符串化
【发布时间】:2021-12-03 20:39:24
【问题描述】:

我有一个阶梯函数f1,它由预定的 EventBridge 规则触发,所以部分执行输入是 time

f1 完成后,我想通过新的 EventBridge 规则触发新的 Step Function f2time 作为输入传递给f2。我尝试将transform the input$.detail.input.time 一起使用,但事实证明input json 被字符串化并且搜索表达式失败????

很遗憾,我不能在 EventBridge 规则中使用 States.StringToJson 作为输入转换的一部分。我所能做的就是传递可怕的字符串化输入(包括时间作为f2$.detail.input 的输入)。

这种情况/限制有什么解决方案吗?

【问题讨论】:

    标签: amazon-web-services aws-step-functions aws-event-bridge


    【解决方案1】:

    使用parameters。步骤函数intrinsic functionsStates.StringToJson 在任务和传递参数中是 supported,但不是输入字段。

    Pass 状态解析传入的字符串化 JSON:

    {
      "StartAt": "ParsePass",
      "States": {
        "ParsePass": {
          "Type": "Pass",
          "Parameters": {
            "payload.$": "States.StringToJson($.escapedJsonString)"
          },
          "Next": "SuccessTask"
        },
        "SuccessTask": { "Type": "Succeed" }
      }
    }
    

    步进输入

    { "escapedJsonString": "{\"foo\": \"bar\"}" }
    

    步进输出

    {"payload": { "foo": "bar" }}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-07
      • 2020-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-13
      • 1970-01-01
      相关资源
      最近更新 更多