camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kraythe ." <kray...@gmail.com>
Subject Re: passing data to a polling consumer
Date Sat, 28 Sep 2013 13:58:11 GMT
I would split on the route and stack the timer before. Any reason you need
it to be 2 routes?

from("timer://myTimer?period=1000")
       to("file:testcsv")
      .unmarshal().csv()
      .split()
      .to("sql:select * from test where id = ${body[id]}")
      .to("direct:point1");

The split will cause each record to process individually. Probably you have
to adjust the code above for your cases (as I am conding without putting it
in an IDE) but you get the basic idea I hope.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*


On Fri, Sep 27, 2013 at 5:09 PM, Dale King <dalewking@gmail.com> wrote:

> What you will probably want to do is do a split on the ids so you then have
> a subroute on each ID. Each subroute then needs to access the database, for
> which you will not use a from, but more probably a content enricher to read
> from the SQL endpoint.
>
>
> On Fri, Sep 27, 2013 at 6:00 PM, lumi <luminitavelicanu@gmail.com> wrote:
>
> > Hi,
> > I don’t know how to pass data from one route that reads a file to another
> > route that is polling a database.
> >
> > First route reads id from file.
> >
> >       from("file:testcsv")
> >       .unmarshal().csv()
> >       .to("direct:point1");
> >
> > Second route needs to use the id in the sql
> >
> >         from("timer://myTimer?period=1000")
> >         .to("sql:select * from test where id = #")
> >         .marshal().csv()
> >         .to("file:target/out ");
> >
> >
> > With sql consumer faced the same question.
> >
> >         from ("sql:select * from test where id = #?consumer.delay=1000")
> >         .marshal().csv()
> >         .to("file:target/out");
> >
> > It seems that I’m missing something very basic here, please help.
> >
> > Thanks and regards,
> > Lumi
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/passing-data-to-a-polling-consumer-tp5740313.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
>
> --
> Dale King
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message