...
Camel supports the Content Filter from the EIP patterns using a Message Translator, by invoking a Java bean or by using a Processor object one of the following mechanisms in the routing logic to filter transform content from the inbound message.
- Message Translator
- invoking a Java bean
- Processor object
A common way to filter messages is to use an Expression in the DSL like XQuery, SQL or one of the supported Scripting Languages.
...
Wiki Markup |
---|
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformViaDSLTest.java} |
...
Wiki Markup |
---|
{snippet:id=example|lang=java|url=activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTest.java} |
For further examples of this pattern in use you could look at one of the JUnit tests
Using Spring XML
Code Block |
---|
<route>
<from uri="activemq:Input"/>
<bean ref="myBeanName" method="doTransform"/>
<to uri="activemq:Output"/>
</route>
|
You can also use XPath to filter out part of the message you are interested in:
Code Block |
---|
<route>
<from uri="activemq:Input"/>
<setBody><xpath resultType="org.w3c.dom.Document">//foo:bar</xpath></setBody>
<to uri="activemq:Output"/>
</route>
|
Include Page | |||
---|---|---|---|
Include Page | |||
|