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 f1 f2 f3 f4 Service A returns Collection 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
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.
Re: Camel Enrich in a Loop
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 > f1 > f2 > f3 > f4 > > Service A returns Collection > 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
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
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 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: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen