支持。嗨,我正在尝试基于路径属性的通道路由。例如,如果配置如下
我想根据路径将消息发送到不同的通道,即path=“网关/搜索”值。查看了基于头的路由和有效负载类型路由。你能建议一下实施的方法吗?
<!-- Inbound/Outbound Channels -->
<int:channel id="ServiceSearchRequest" />
<int:channel id="ServiceSearchResponse" />
<int-http:inbound-gateway id="inboundEmployeeSearchRequestGateway"
supported-methods="GET, POST" request-channel="ServiceSearchRequest"
reply-channel="ServiceSearchResponse"
mapped-response-headers="Content-Type"
path="ieg/Service/search" request-payload-type="java.lang.String"
reply-timeout="5000">
</int-http:inbound-gateway>
<int-http:outbound-gateway request-channel="ServiceSearchRequest"
reply-channel="ServiceSearchResponse"
url="http://localhost:8080/proj/Service/avgWaitTime123.json"
http-method="POST" expected-response-type="java.lang.String"
mapped-response-headers="Content-Type" />
发布于 2014-12-22 13:42:38
不清楚您想要什么;您只有一个path (ieg/dataService/search),所以如果您在路径上路由,所有消息都会转到单个通道。
如果您的意思是您想要根据某个查询字符串参数..?foo=bar进行路由,那么您可以向入站网关添加一个<header/>元素来捕获它作为一个标头。
<int-http:header name="foo" expression="#requestParams.foo.get(0)" />然后可以使用报头值路由器。有关头表达式可用变量的完整列表,请参见参考文献 (向下滚动到URI Template Variables and Expressions )。
https://stackoverflow.com/questions/27597100
复制相似问题