Removing unwanted messages (Simple)
Not all messages are interesting and worth processing. Some applications generate too much noise, and only messages matching criteria should continue down a pipeline. In these kind of situations Message Filter pattern is used to eliminate undesirable messages, as shown in the following figure:
Getting ready
The complete source code for this tutorial is located under the following project: camel-message-routing-examples/removing-unwanted-messages
.
How to do it...
Start with a filter definition, followed by a predicate expression and the processors to which this filter applies:
from("direct:start") .filter(header("userStatus").isEqualTo("valid")) ...
Get Instant Apache Camel Message Routing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.