krisp
krisp

Reputation: 73

apache camel <simple trim="true" is not working

I'm reading a simple content from a file, say "80631". i validate it against a regex("^\d+$") to check it's just digits. But the validation fails. When i inspect the content read from the file it's something like "80631 ". I tried to trim the whitespace with , but it didn't work. Do we have any other way to trim the whitespace?

<camel:setProperty propertyName="messageId">
  <simple trim="true">${body}</simple>
</camel:setProperty>

Upvotes: 1

Views: 2827

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55750

You should likely show the code to get better help. But <simple trim="true"> ... </simple> is trimming the output of the expression.

Its not for trimming message body.

You need to use message transformation beforehand to trim the message body. Or write a regular expression that ignore leading/ending whitespace.

Upvotes: 2

Related Questions