One Star

How to process the parameters of a http get request in a route

Hello,
I'm trying to create a route which has a chttp server as the input component.
This component is linked to a cTalendJob. The output of that job is a simple csv file.
With a single cFile Input component (there is only one column and one row in it) i managed to get the route up and running. But now I want to change the input file to the cHttp component.
The URI for the server endpoint is http://localhost:8088/customers
Now I want to add a parameter to this URI like that: http://localhost:8088/customers?id=754
How can I forward that id to the job?
best regards,
alois
3 REPLIES
One Star

Re: How to process the parameters of a http get request in a route

I have the same problem. Did you find a solution ?
One Star

Re: How to process the parameters of a http get request in a route

My solution (only on Talend ESB v5.3.x) :
1) create route
2) put cHttp component in server mode (see documentation)
- uri = "http://localhost:8088/service"
3) put cSetBody :
- language = header
- expression = "id"
4) put cTalendJob and put your job inside
Execute this job. In your favorite browser enter "http://localhost:8088/service?id=toto"
=> body = toto into your subjob !!
Employee

Re: How to process the parameters of a http get request in a route

Take a look at these quick screen casts. It may help shed some light on things.
http://www.screenr.com/cpxH
http://www.screenr.com/vmxH
The tRouteInput component uses the Camel Simple expression language to read properties from the Camel Exchange into the Job's data flow. Simple will let you pull values straight out of headers. I suggest checking out the Camel documentation for Simple - it's a key part to writing good Routes!
http://camel.apache.org/simple.html