Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the asciidoc in the repository: https://github.com/apache/camel/blob/master/README.md https://github.com/apache/camel/blob/master/components/readme.adoc
Available as of Camel 2.3
Validate uses an expression or predicates to validate the contents of a message. It is useful for ensuring that messages are valid before attempting to process them.
You can use the validate DSL with all kind of Predicates and Expressions. Validate evaluates the Predicate/Expression and if it is false a
Using from Java DSL
The route below will read the file contents and validate them against a regular expression.
Validate is not limited to the message body. You can also validate the message header.
You can also use validate together with simple.
Using from Spring DSL
To use validate in the Spring DSL, the easiest way is to use simple expressions.
The XML DSL to validate the message header would looks like this: