The validate pattern provides a convenient syntax to check whether the content of a message is valid. The validate DSL command takes a predicate expression as its sole argument: if the predicate evaluates to true
, the route continues processing normally
Java DSL example
The following route validates the body of the current message using a regular expression:
...
Code Block |
---|
from("jms:queue:incoming") .validate(simple("${in.header.bar} == 100")) .to("bean:MyServiceBean.processLine"); |
XML DSL example
The following route validates the body of the current message using a regular expression:
...