Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

camel http endpoint forming url dynamically

Guys I am trying to use

{
from("direct:a").to (someUrl).processor(new Processor(){

   @Override
   public void process(Exchange arg0) throws Exception
   {
      // do something
   }

});


where someUrl is of the type http://xyz.com/{id}?test=<value1>&test1=<value2>
}

and this url will change on every request to the route.

What i have already tried. Passing params as headers and try to access in the route using the header("test") and using ${in.header.test} both doesn't seem to work.

any suggestions will be greatly helpful.

like image 241
Subodh Gupta Avatar asked Dec 15 '22 13:12

Subodh Gupta


2 Answers

From camel 2.16 you can do things like this -

from("direct:start")   
   .toD("${header.foo}");

Refer : http://camel.apache.org/message-endpoint.html

like image 196
Gopi Avatar answered Dec 18 '22 03:12

Gopi


See this FAQ about dynamic to endpoints in Camel: https://camel.apache.org/manual/latest/faq/how-to-use-a-dynamic-uri-in-to.html

like image 35
Claus Ibsen Avatar answered Dec 18 '22 01:12

Claus Ibsen