无法使用下面的
访问路由器的value属性中的标头<int:router input-channel="route_profile" expression="#jsonPath(payload, '$.entity')">
<int:mapping value="headers.userId" channel="toWeb_send"/>
<int:mapping value="headers.otherId" channel="find_preferences"/>
</int:router>
这里的任何事我都做错了。
答案 0 :(得分:1)
表达式不是value
属性中预期的表达式:
<xsd:attribute name="value" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
A value of the evaluation token that will be mapped to a channel reference
(e.g., mapping value='foo' channel='myChannel')
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
此value
正是所提到的顶级expression
返回的内容。
因此,让我们对您的expression="#jsonPath(payload, '$.entity')"
进行成像可能会返回foo
或bar
,因此映射必须如下:
<int:mapping value="foo" channel="toWeb_send"/>
<int:mapping value="bar" channel="find_preferences"/>
如果这些标题周围有一些逻辑,则必须将它们包含在表达式评估中。或者您可以选择其他方式来计算路由密钥。