You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sushil_vsk5 <su...@yahoo.co.in> on 2013/07/31 09:17:42 UTC

Camel Enrich in a Loop

Hello,
I have the following use case,
>From a route, I want to call a remote service A using CXF which gives me a
list of data. For each data element in the list, I populate a response
object, and then I again have to call service B to get addtional data to
enrich this response object. Finally, I will return a collection of response
objects. How should I implement this in the best way?
For example,

Response - Collection<X>
X
 f1
 f2
 f3
 f4

Service A returns Collection<P>
I map from each element of this collection to create a new X with fields f1
and f2 populated. Then I call Service B which returns object Q with which I
populate fields f3 and f4. Finally I return a collection of X

What are the best patterns to realize this use case?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Enrich-in-a-Loop-tp5736543.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Enrich in a Loop

Posted by Claus Ibsen <cl...@gmail.com>.
See also the content enricher EIP.

Or use a java bean and do the calls from there and merge the replies
into a response etc. You dont have to do 100% in Camel routes. You can
use java code as well.

On Thu, Aug 1, 2013 at 12:09 PM, sushil_vsk5 <su...@yahoo.co.in> wrote:
> I am not sure whether a simple Splitter / Aggregator combination can help me
> address this. Should these be sufficient for the case that I described?
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Enrich-in-a-Loop-tp5736543p5736629.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel Enrich in a Loop

Posted by sushil_vsk5 <su...@yahoo.co.in>.
I am not sure whether a simple Splitter / Aggregator combination can help me
address this. Should these be sufficient for the case that I described?




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Enrich-in-a-Loop-tp5736543p5736629.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel Enrich in a Loop

Posted by Willem jiang <wi...@gmail.com>.
Splitter[1] + Aggregator[2].

[1]http://camel.apache.org/splitter.html
[2]http://camel.apache.org/aggregator2.html


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, July 31, 2013 at 3:17 PM, sushil_vsk5 wrote:

> Hello,
> I have the following use case,
> From a route, I want to call a remote service A using CXF which gives me a
> list of data. For each data element in the list, I populate a response
> object, and then I again have to call service B to get addtional data to
> enrich this response object. Finally, I will return a collection of response
> objects. How should I implement this in the best way?
> For example,
>  
> Response - Collection<X>
> X
> f1
> f2
> f3
> f4
>  
> Service A returns Collection<P>
> I map from each element of this collection to create a new X with fields f1
> and f2 populated. Then I call Service B which returns object Q with which I
> populate fields f3 and f4. Finally I return a collection of X
>  
> What are the best patterns to realize this use case?
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Enrich-in-a-Loop-tp5736543.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Camel Enrich in a Loop

Posted by sushil_vsk5 <su...@yahoo.co.in>.
Hello Guys:
Can you assist me with this please?
Regards,
Sushil



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Enrich-in-a-Loop-tp5736543p5736615.html
Sent from the Camel - Users mailing list archive at Nabble.com.