Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.此内容没有您所选择的语言版本。
8.2. Content Filter
Overview 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The content filter pattern describes a scenario where you need to filter out extraneous content from a message before delivering it to its intended recipient. For example, you might employ a content filter to strip out confidential information from a message.
Figure 8.2. Content Filter Pattern
A common way to filter messages is to use an expression in the DSL, written in one of the supported scripting languages (for example, XSLT, XQuery or JoSQL).
Implementing a content filter 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
A content filter is essentially an application of a message processing technique for a particular purpose. To implement a content filter, you can employ any of the following message processing techniques:
- Message translator—see message translators.
- Processors—see Chapter 41, Implementing a Processor.
XML configuration example 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
The following example shows how to configure the same route in XML:
Using an XPath filter 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
You can also use XPath to filter out part of the message you are interested in:
<route> <from uri="activemq:Input"/> <setBody><xpath resultType="org.w3c.dom.Document">//foo:bar</xpath></setBody> <to uri="activemq:Output"/> </route>
<route>
<from uri="activemq:Input"/>
<setBody><xpath resultType="org.w3c.dom.Document">//foo:bar</xpath></setBody>
<to uri="activemq:Output"/>
</route>