Issue
Is it possible to call something like this in Apache Camel's Spring DSL
<setHeader headerName="timestampPart3"><simple>${header.timestampPart2.substring(0, ${header.timestampPart2.length()} - 2)}</simple></setHeader>
or like this
<setHeader headerName="timestampPart3"><simple>${header.timestampPart2.substring(0, header.timestampPart2.length() - 2)}</simple></setHeader>
For the second attempt it identifies .length() - 2
as a single method name call
Solution
You can increment and decrement with simple, so...
I wouldn't recommend, but for example:
<setHeader headerName="timestampPart2_1">
<simple>${header.timestampPart2.length()}--</simple>
</setHeader>
<setHeader headerName="timestampPart2_1">
<simple>${header.timestampPart2_1}--</simple>
</setHeader>
<setHeader headerName="timestampPart3">
<simple>${header.timestampPart2.substring(0, ${header.timestampPart2_1})}</simple>
</setHeader>
Answered By - techtheist
Answer Checked By - Katrina (JavaFixing Volunteer)