Apache Camel: Accessing CamelLoopIndex
apache-camel
Solution
I'm late to the party but maybe somebody will get help from this answer. In the example given above this works for me for accessing the loop index in the Java DSL.
property(Exchange.LOOP_INDEX)
So for the example in the first post from okello above I guess this will work
Integer.valueOf(property(Exchange.LOOP_INDEX).toString())
Problem
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:" + classesBaseDir + "/" + fileTypes[Integer.valueOf("${CamelLoopIndex}")]); ``` As shown, I wish to access the `CamelLoopIndex` and use it as an index in an array. The expression is not evaluated, hence the route is not created. What am I doing wrong? Thanks in advance. Documentation on this is pretty scanty, and I've not been successful getting a solution after hours of searching. UPDATE: I've posted the same question to the Camel Users Mailing List.