如何将REST触发pathParam转换为活动输入参数

时间:2018-08-08 13:11:11

标签: tibco

我试图用路径参数化的触发器创建一个flogo应用程序。触发器应响应这样的呼叫:

curl -X POST localhost:8080/trigger/apply

在上面的示例中,“ apply”是我要作为名为“ command”的输入参数传递到流首个活动的字符串。

  "handlers": [
    {
      "actionId": "kubectlAction",
      "actionMappings": {
        "input": [
          {
            "mapTo": "command",
            "type": 1,
            "value": "pathParams.command"
          }
        ],
        "output": [
          {
            "mapTo": "data",
            "type": 1,
            "value": "someResponse"
          }
        ]
      },
      "settings": {
        "method": "POST",
        "path": "/trigger/:command"
      }
    }
  ] 

我认为问题主要是,在哪个映射作用域(哪个映射作用域)在REST输入处理程序所在的位置设置了“ command”属性,以及如何在我的活动中为输入Parameter引用它。

以下是我目前尝试引用该媒体资源的操作,但没有成功:

“动作”:[     {       “ id”:“ kubectlAction”,       “ name”:“我的kubectl动作”,       “ ref”:“ github.com/TIBCOSoftware/flogo-contrib/action/flow”,       “数据”:{         “流”: {           “ name”:“我的kubectl流”,           “属性”:[],           “ rootTask”:{             “ id”:1             “类型”:1,             “任务”: [               {                 “ id”:2                 “类型”:1,                 “ activityRef”:“ gitlab.spe.mobi/cbfr-demo/kubecontrol”,                 “ name”:“ log”,                 “属性”:[],                 “ inputMappings”:[                   {                     “类型”:1,                     “ value”:“ $ property [valve-red-a]”,                     “ mapTo”:“ yaml”                   },                   {                     “类型”:1,                     “ value”:“ $ flow.command”,                     “ mapTo”:“命令”                   }                 ]               }             ],             “链接”:[             ]           }         }       }     }   ]

任何帮助,不胜感激!

1 个答案:

答案 0 :(得分:0)

您应该为流程定义输入,并将其用作活动输入。