0

我是 Apache Camel 的新手,没有找到解决问题的优雅方法。我收到如下传入请求:

servlet:/services?http:///services?param1=value1¶m2=value2…</p>

我想动态路由到

http:///services?param1=value1¶m2=value2…</p>

当 uri servlet:/services 被“检测到”时(来自)

我可以从 header("CamelHttpQuery") 中提取 endrequest,但我不知道如何将它用于转发。这是我尝试过的实现,但它不起作用:

public class Routes extends SpringRouteBuilder {
    @Override
    public void configure() throws Exception {   
        this.from("servlet://{{path.directory.service}}?matchOnUriPrefix=true").beanRef("filterPolicy", "canAccess")
            .recipientList(this.header("CamelHttpQuery")).removeHeaders("CamelHttp*")
    }
}
4

1 回答 1

0

动态端点有toD方法 http://camel.apache.org/message-endpoint.html

Fe我有这个动态uri的工作代码

  <setHeader headerName="customerId">
    <ognl>request.body.customerId</ognl>
  </setHeader>
  <setBody><constant></constant></setBody>
  <setHeader headerName="CamelHttpMethod">
      <constant>GET</constant>
  </setHeader>            
  <toD uri="http4://localhost:9292/score/customer/${header.customerId}?bridgeEndpoint=true"/>   
于 2019-01-02T09:38:30.450 回答