需要手动在路由中心设置自定义属性。示例代码如下:
{
"routes": {
"customRoute": "FROM /messages/* INTO BrokeredEndpoint(\"/modules/module1/inputs/input1\")",
"customPropertiesRoute": "FROM /messages/modules/module1/outputs/output1 INTO BrokeredEndpoint(\"/modules/module2/inputs/input2\")",
"customPropertiesRouteWithProperties": "FROM /messages/modules/module1/outputs/output2 WHERE $body.custom.property = 'value' INTO BrokeredEndpoint(\"/modules/module3/inputs/input3\")"
},
"storeAndForwardConfiguration": {
"timeToLiveSecs": 7200
}
}
在上面的示例中,我们设置了三个路由:customRoute,customPropertiesRoute和customPropertiesRouteWithProperties。其中,customRoute没有任何自定义属性;customPropertiesRoute通过“$ body”语法将自定义属性添加到传递的消息中;customPropertiesRouteWithProperties则仅将指定属性值满足特定条件的消息传递到下一个模块。