数据读写
Exchange 属性
type property
设置或删除 exchange 属性
使用说明
要点:设置或删除 Exchange 属性。removeProperty 时只需要 property 与 operation。
属性
| 字段 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
property属性名 |
文本 | 必填 | — | |
operation操作 |
枚举 | 必填 | setProperty |
|
lang表达式语言 |
枚举 | 可选 | — | |
script表达式内容 |
多行文本 | 可选 | — |
示例流程
可直接保存为 demo-property.json 并部署;非入口节点默认套了一个 REST 入口。
{
"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。