Filter Processor

The Filter processor can be used to prevent uninteresting or unwanted messages from reaching the producer endpoint. It will accept a single predicate argument: if the predicate absolves to true, then the message exchange is allowed through to the producer; however if the predicate is false, the message exchange is blocked.

XML DSL:

<camelContext id="filterRoute" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="SourceURL"/> <filter> <simple>header.foo = 'bar'</simple> <to uri="TargetURL"/> </filter> </route> </camelContext>

 

Java DSL:

from("SourceURL").filter(header("foo").isEqualTo("bar")).to("TargetURL");