camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale King <d...@jadabeauty.com>
Subject Re: Creating routes dynamically like a for()
Date Wed, 02 Oct 2013 14:22:37 GMT
The confusion is whether you really mean that you want to CREATE new routes dynamically (which
would be very unusual) or whether you really mean that you have some processing steps and
you want to RUN those steps once for each record returned (which is much more common).

In the later case, a splitter is what you want. For example:

from("sql://yourQuery")
.split().body()
    .log("This sub-route is run once per record from your query")
    .log("The body of the exchange will be one record")
    // Other processing steps ran on each record
.end()
.log("This is ran after all records have been ran through")
.log("The exchange will be the original unless you do something")
.log("different with an aggregation strategy on the splitter")

On Oct 2, 2013, at 4:49 AM, mamouros <csst0211@yahoo.gr> wrote:

> To further clarify, I have a database with smpp accounts. I want to query at
> runtime the database every predefined time, get the username and password
> and then open a consumer for each account either with separate from() routes
> passing the credentials or creating separate consumer templates.
> 
> At  runtime:
> query database ->
>     returns 3 accounts
> create 3 routes ->
>    from( account 1 )
>    from( account 2 )
>    from( account 3 )
> go again from start
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Creating-routes-dynamically-like-a-for-tp5740703p5740746.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message