Flow ServerStarter
数据读写

Exchange 属性

type property

在设计器中打开 ↗

设置或删除 exchange 属性

使用说明

要点:设置或删除 Exchange 属性。removeProperty 时只需要 property 与 operation。

属性

字段类型必填默认值说明
property
属性名
文本 必填 —
operation
操作
枚举 必填 setProperty
可选值:setProperty、removeProperty
lang
表达式语言
枚举 可选 —
可选值:constant、simple、groovy、header、exchangeProperty、method、jsonpath、xpath、spel
script
表达式内容
多行文本 可选 —

示例流程

可直接保存为 demo-property.json 并部署;非入口节点默认套了一个 REST 入口。

Flow JSON
{
  "id": "demo-property",
  "desc": "Exchange 属性 示例",
  "group": "示例/数据读写",
  "schemaVersion": 1,
  "nodes": [
    {
      "id": "n1",
      "type": "rest",
      "props": {
        "method": "POST",
        "path": "/demo/property",
        "desc": "示例入口"
      }
    },
    {
      "type": "property",
      "props": {
        "property": "orderId",
        "operation": "setProperty",
        "lang": "simple",
        "script": "${header.id}"
      },
      "id": "n1"
    },
    {
      "type": "log",
      "props": {
        "message": "exchange 属性 orderId=${exchangeProperty.orderId}",
        "level": "INFO"
      },
      "id": "n2"
    }
  ]
}
部署这段流程
curl -X POST 'http://localhost:8086/flow' \
  -H 'Content-Type: application/json' \
  -H 'X-Flow-Token: change-me' \
  --data-binary @demo-property.json

调用方式

如何触发:示例使用 REST 入口,部署后调用 POST http://localhost:8086/demo/property。

相关节点