git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Math Operation in Loop


Hi,

I want to have some math operation in route loop based on the index:

.loop(5)
.log(String.valueOf(Integer.parseInt("${property.CamelLoopIndex}")*10+1));

But I got error:
error=For input string: "${property.CamelLoopIndex}"}

If I change it to a constant string, it works. (e.g. "1").
I also tried use simple without any luck.
setheader and setbody would cause the same issue when retrieving value
${hearder.<name>}

I want to create a variable outside dsl, but not sure how to assign
variable value in the dsl.

How to do a math calculation based on the loop index.

-- 
Weiqiang