Re: Enrich with data from SQL

2013-03-07 Thread Jean Francois LE BESCONT
I have found a solution I will post a whole example when every thing will work in my project. 2013/3/7 Jean Francois LE BESCONT > Thanks for all these explictions ! Hope I will give back my knowledge when > I will have enough camel knowledge :) > > With filter, I goto my enrich only for the f

Re: Enrich with data from SQL

2013-03-07 Thread Jean Francois LE BESCONT
Thanks for all these explictions ! Hope I will give back my knowledge when I will have enough camel knowledge :) With filter, I goto my enrich only for the first line of my file. .filter(simple("${property.CamelSplitIndex} == 0")) .enrich("direct:datasource", new AggregationEnrichissementZo

Re: Enrich with data from SQL

2013-03-07 Thread Thibault Cassan
Hi Claus, I am no specialist, but in your case, it would seem the enrichment will happen only on the first line of the csv, isn't it ? >From what I understood, Jean-François, would want to enrich each line, with the same data incoming from his database. What if he synchronizes two routes ? A first

Re: Enrich with data from SQL

2013-03-07 Thread Raul Kripalani
If you want to query the DB once, you should definitely restructure the route a bit. Here's the simplest option IMO. The goal is to query once and make the query result available to all split tasks: - Run bindy before the split, which will generate a List of AED objects. - Create a small bean tha

Re: Enrich with data from SQL

2013-03-07 Thread Claus Ibsen
On Thu, Mar 7, 2013 at 9:25 AM, Jean Francois LE BESCONT wrote: > Sorry if my explanation are not good ... :) > > I have a csv file. I would like to process this file to enrich with data > in sql table (then write enriched line in output). > > I process file with a binding in business class : >

Re: Enrich with data from SQL

2013-03-07 Thread Jean Francois LE BESCONT
Sorry if my explanation are not good ... :) I have a csv file. I would like to process this file to enrich with data in sql table (then write enriched line in output). I process file with a binding in business class : .from("file://mycsv.csv") .split() .tokenize("\n") .streaming() .unmarshal()

Re: Enrich with data from SQL

2013-03-06 Thread Claus Ibsen
On Thu, Mar 7, 2013 at 8:03 AM, Jean Francois LE BESCONT wrote: > it is a really simple studies case no ? I can't be the first guy who > don't want to reload the datasource on each line isn't it ? > I dont think people can understand what you try to do and pasting a lot of code and with little

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
it is a really simple studies case no ? I can't be the first guy who don't want to reload the datasource on each line isn't it ? 2013/3/6 Jean Francois LE BESCONT > I made a mistake in my test. It doesn't do what expected ... > > Still the same example : > > .from(...) > .split() > .tokeniz

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
I made a mistake in my test. It doesn't do what expected ... Still the same example : .from(...) .split() .tokenize("\n") .streaming() .unmarshal() .bindy(BindyType.Csv, AED.class) .enrich("direct:refreshReferentielDynamic", new AggregationEnrichissementZone()) And a : from("direct:refreshRefer

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
Thanks Claus ! Tricky but it works :) 2013/3/6 Claus Ibsen > On Wed, Mar 6, 2013 at 1:05 PM, Jean Francois LE BESCONT > wrote: > > When we do an enrich, the *resourceUri ( in my example > *.enrich("direct:ds", > > new AggregationStrategyRessource())) is called every time. > > > > When I pars

Re: Enrich with data from SQL

2013-03-06 Thread Claus Ibsen
On Wed, Mar 6, 2013 at 1:05 PM, Jean Francois LE BESCONT wrote: > When we do an enrich, the *resourceUri ( in my example *.enrich("direct:ds", > new AggregationStrategyRessource())) is called every time. > > When I parse a file, big query with all the datasource while be called > every, is there

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
When we do an enrich, the *resourceUri ( in my example *.enrich("direct:ds", new AggregationStrategyRessource())) is called every time. When I parse a file, big query with all the datasource while be called every, is there a trick to tell the route to execute only one ? I have watch camel cache b

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
Thanks Claus for the link ( have you an HashMap off the FAQ in the head ? :) Don't forget to add : original.getOut().setHeaders(original.getIn().getHeaders()); When enrich with strategy ! 2013/3/6 Claus Ibsen > On Wed, Mar 6, 2013 at 10:26 AM, Jean Francois LE BESCONT > wrote: > > My

Re: Enrich with data from SQL

2013-03-06 Thread Claus Ibsen
On Wed, Mar 6, 2013 at 10:26 AM, Jean Francois LE BESCONT wrote: > My mistake ...I used resource.getOut().getBody(); instead > od resource.getIn().getBody(); > Yeah see this FAQ http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html > > public Exchange aggregate(Exchange ori

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
My mistake ...I used resource.getOut().getBody(); instead od resource.getIn().getBody(); public Exchange aggregate(Exchange original, Exchange resource) { AED originalBody = (AED)original.getIn().getBody(); Object resourceResponse = (Object) resource.getIn().getBody(); LOG.info("or

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
Thanks Raul ! I haven't found simple example enrich here ( http://camel.apache.org/content-enricher.html, direct:resource in never explains ). Perharps that I haven't understand fondamental but it's a huge framework and learning needs time :) So I have a querie : from("direct:refreshReferentiel

Re: Enrich with data from SQL

2013-03-06 Thread Jean Francois LE BESCONT
Hey ! A picture is sometime better than explication :) I try to make a really simple test ( equivalent of MAP with lookup in ETL) : - | TABLE TEST |

Re: Enrich with data from SQL

2013-03-06 Thread Raul Kripalani
You are returning the original exchange. That's why it appears as if nothing happened in the enrichment. The idea behind enriching is that you alter the original exchange with some values from the "call out" exchange, e.g. adding properties or headers, augmenting the body with more data, etc. Ther

Re: Enrich with data from SQL

2013-03-05 Thread Jean Francois LE BESCONT
If i do: public class AggregationStrategyRessource implements AggregationStrategy { @Override public Exchange aggregate(Exchange original, Exchange resource) { int i = 1 / 0; return original; } } no exception are thows. 2013/3/6 Jean Francois LE BESCONT > thks Raul > > For t

Re: Enrich with data from SQL

2013-03-05 Thread Jean Francois LE BESCONT
thks Raul For the moment it's a simple : public class AggregationStrategyRessource implements AggregationStrategy { @Override public Exchange aggregate(Exchange original, Exchange resource) { return original; } } If I put a debug point on it, it is never fired 2013/3/

Re: Enrich with data from SQL

2013-03-05 Thread Raúl Kripalani
Can we see the code of AggregationStrategyRessource? Regards, Raúl. On Mar 5, 2013, at 23:30, Jean Francois LE BESCONT wrote: > Hey, > > I have this > > http://camel.465427.n5.nabble.com/Enrich-message-with-data-from-dynamic-sql-query-td5329427.html > > But I haven't found a solution to my que