简体   繁体   中英

Camel proxy Dynamic url Parameter setting

I have a route:

From route is a REST Call.

 from("http://com.containerhost:8080/").
    .setHeader("param3",param3)
    .to(anotherURL?queryparam1="queryparam1ofRESTCALL"&queryparam2="queryParam2ofRESTCall"&queryparam3=${header.param3}")

But camel is not recognizing this param 3 even though its set in header. In my case param 3 is a key. which has to be added only to a TO uri and it should not be exposed to FROM Uri Rest call.So please tell me how to dynamically add more than one parametes in this scenario.When i went through the forum,they told me to look into recepient list.But couldnt get much info from Camel http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html I dont know how to use Recepient list. If you could give me some inputs it will of a great help. Thanks and regards.

recipient-list with simple is the dynamic-to. Just do:

.recipientList(simple("anotherURL?queryparam1=queryparam1ofRESTCALL
                       &queryparam2=queryParam2ofRESTCall
                       &queryparam3=${header.param3}"));

除了recipientList模式之外,您可以设置Exchange.HTTP_QUERY标头:

exchange.getIn().setHeader(Exchange.HTTP_QUERY, "...");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM