You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by miri eyni <mi...@sapiens.com> on 2016/05/23 10:49:13 UTC

Routing question

hi ,


i need to implements routing with logic.
i will get the request , processing the request should  read from different
APIs (external API) to make a  new request for the endpoint.

for example : 

process (){
S1 =  consume  API1
s2 = consume API2
s3= consume API3

newRequest.setS1(s1)
newRequest.setS2(s2)
newRequest.setS3(s3)

exchange.getIn().setBody(newRequest)
}
what is the best way to implements?



--
View this message in context: http://camel.465427.n5.nabble.com/Routing-question-tp5782945.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Routing question

Posted by miri eyni <mi...@sapiens.com>.
thanks for your answer.

in this case i am lose the orig request?



--
View this message in context: http://camel.465427.n5.nabble.com/Routing-question-tp5782945p5783285.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Routing question

Posted by arno noordover <ar...@noordover.net>.
I would take a look at http://camel.apache.org/content-enricher.html

If you don't want to use a AggregrationStrategy you could do the following
in a route:
1. call the first endpoint;
2. move the payload to a header (setHeader);
3. call second endpoint;
4. move the payload to another header;
5. call third endpoint;
6. use some kind of scripting or whatever to create a new payload en call
methods on it using the headers from step 2 and 4.

Another solution might be to use http://camel.apache.org/multicast.html.
I think that using the GroupedExchangeAggregationStrategy you get a List in
the payload containing all the responses.



--
View this message in context: http://camel.465427.n5.nabble.com/Routing-question-tp5782945p5783075.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Routing question

Posted by miri eyni <mi...@sapiens.com>.
i didn't try it.

where can i store the responses values? 

i need call to different APIs to get metadata before i call to target
request ?


thanks 




--
View this message in context: http://camel.465427.n5.nabble.com/Routing-question-tp5782945p5783058.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Routing question

Posted by souciance <so...@gmail.com>.
Have you tried it yourself first? Where have you failed?

On Mon, May 23, 2016 at 12:49 PM, miri eyni [via Camel] <
ml-node+s465427n5782945h58@n5.nabble.com> wrote:

> hi ,
>
>
> i need to implements routing with logic.
> i will get the request , processing the request should  read from
> different APIs (external API) to make a  new request for the endpoint.
>
> for example :
>
> process (){
> S1 =  consume  API1
> s2 = consume API2
> s3= consume API3
>
> newRequest.setS1(s1)
> newRequest.setS2(s2)
> newRequest.setS3(s3)
>
> exchange.getIn().setBody(newRequest)
> }
> what is the best way to implements?
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Routing-question-tp5782945.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h31@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c291Y2lhbmNlLmVxZGFtLnJhc2h0aUBnbWFpbC5jb218NDY1NDI4fDE1MzI5MTE2NTY=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Routing-question-tp5782945p5782949.html
Sent from the Camel - Users mailing list archive at Nabble.com.