Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus, I use the loop to retrieve the destinations for the content based router. The destinations are less than 10 but there's no way of telling in advance which ones they will be. So, I thought using a loop to dynamically build the destination makes more sense. I tried dynamic routes, and oth

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi Well use the loop in the route if its sort make sense to have it there, as it kinda stand out in the route, so people seeing the route, can see its looping. Though if its not important, you can just do a for loop in the java code in the processor. On Fri, Apr 12, 2013 at 4:30 PM, Okello Nel

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus, Yes, it's the loop calling the process X times. I implemented it that but I wasn't sure its the best way to do it. Thanks a lot. Kind Regards, Okello Nelson. On Fri, Apr 12, 2013 at 5:26 PM, Claus Ibsen wrote: > Hi > > Do you mean its the loop that calls the process X times. If so y

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi Do you mean its the loop that calls the process X times. If so yeah, that is working correctly as designed. Calling the process() method of a org.apache.camel.Processor is actually what the Camel routing engine does at runtime. In fact each of these EIPs you may use in the routes, are implemen

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus, Going through you comment again, I notice you've mentioned that the "configure()" method of the "RouteBuilder" is only executed once; when the route is started. In my code, I'm executed this method once. The only method I'm calling repeatedly (for the length of the "fileTypes" array) is

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus, Thanks a lot for the insight. My objective was to create a content based router using information stored in an external file. I inject the information into an array field using Spring, and so far the route appears to be working. But your explanation does give me something to think about

Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi The code in the configure() method of a RouteBuilder is only executed once, when Camel startup and build the route from what you defined in the configure method. So at runtime you need to use languages http://camel.apache.org/languages Or a java bean / camel processor / create your own predic

Re: Accessing CamelLoopIndex in route

2013-04-11 Thread Okello Nelson
ail.com> wrote: > Try: > .when(simple("${header[CamelFileName]} contains > ${header[CamelLoopIndex]}")) > > You can find more about the simple language at [1]. > > [1] http://camel.apache.org/simple.html > > Best, > Christian > > > > -

Re: Accessing CamelLoopIndex in route

2013-04-11 Thread Christian Mueller
Try: .when(simple("${header[CamelFileName]} contains ${header[CamelLoopIndex]}")) You can find more about the simple language at [1]. [1] http://camel.apache.org/simple.html Best, Christian -- View this message in context: http://camel.465427.n5.nabble.com/Accessing-CamelLoopInde

Accessing CamelLoopIndex in route

2013-04-11 Thread Okello Nelson
Hi guys, I have the following route DSL: from("file:" + autoLoadBaseDir + "?move=.classified") .loop(fileTypes.length) .choice() .when(header("CamelFileName").contains(fileTypes[Integer.valueOf("${CamelLoopIndex}")])) .to("file:" +