I have a setHeader tag in my route:
<setHeader headerName="timestampPart3"><simple>${header.timestampPart2.split("\\.")[0]}</simple></setHeader>
<log message="After: ${body} ${headers}"/>
I expect, it will split the String inside the timestampPart2 header and take the first element.
In fact, it just ignores the splitting:
timestampPart2=114128.0, timestampPart3=114128.0
So how I should implement regex escaping in Spring DSL? If for some reason it is impossible, how to work that around?
To set an
Exchangemessage header you would need to use thenamefield and not theheaderNamefield:Additionally you need to provide a raw
regexexpression for string#splitmethod that will get sanitized (if needed) under the hood automatically by the OGNL - Camel parsing layer for you: