此内容没有您所选择的语言版本。

13.7.12. ContentBasedRouter


Expand
Class org.jboss.soa.esb.actions.ContentBasedRouter
Content based message routing action.
This action supports the following routing rule provider types:
  • XPath: Simple XPath rules, defined inline on the action, or externally in a .properties format file.
  • Drools: Drools rules files (DSL). Out of the box support for an XPath based DSL.
Expand
Table 13.22. ContentBasedRouter Properties
Property Description Required
cbrAlias
Content Based Routing Provider alias. Supported values are "Drools" (default), "Xpath" and "Regex".
ruleSet
Externally defined rule file. It will be a Drools DSL file if the Drools rule provider is in use, or a .properties rule file if the XPath or Regex provider is in use.
ruleLanguage
CBR evaluation Domain Specific Language (DSL) file. Only relevant for the Drools rule provider.
ruleReload
Flag indicating whether or not the rules file should be reloaded each time. Default is “false”.
ruleAuditType
Optional property to have Drools perform audit logging. The log can be read into the Drools Eclipse plugin and inspected. Valid values are CONSOLE, FILE and THREADED_FILE. The default is that no audit logging will be performed.
 
ruleAuditFile
Optional property to define the filepath for audit logging. Only applies to FILE or THREADED_FILE ruleAuditType. The default is "event". Note that JBoss Drools will append ".log" for you. The default location for this file is "." - the current working directory (which for JBoss is in its bin/ directory).
 
ruleAuditInterval
Optional property to define how often to flush audit events to the audit log. Only applies to the THREADED_FILE ruleAuditType. The default is 1000 (milliseconds).
 
destinations
Container property for the <route-to> configurations. If the rules are defined externally, this configuration will have the following format:
<route-to destination-name="express" 
    service-category="ExpressShipping" service-name="ExpressShippingService"/>
Copy to Clipboard Toggle word wrap
If the rules are defined inline in the configuration, this configuration will have the following format (not supported for the Drools provider):
<route-to service-category="ExpressShipping" 
    service-name="ExpressShippingService" expression="/order[@statusCode='2']" />
Copy to Clipboard Toggle word wrap
namespaces
Container property for the <namespace> configurations where required (for example, for the XPath ruleprovider). The <namespace> configurations have the following format:
<namespace prefix="ord" uri="http://acme.com/order" />
Copy to Clipboard Toggle word wrap
Expand
Table 13.23. ContentBasedRouter "process" methods
Property Description Required
process
Do not append aggregation data to the message.
split
Append aggregation data to the message.

Example 13.13. Sample Configuration XPATH (inline)

<action process="split" name="ContentBasedRouter" 
    class="org.jboss.soa.esb.actions.ContentBasedRouter">
    <property name="cbrAlias" value="XPath"/>
    <property name="destinations">
        <route-to service-category="ExpressShipping"                 
            service-name="ExpressShippingService" expression="/order['status='1']" />
        <route-to service-category="NormalShipping"  
            service-name="NormalShippingService" expression="/order['status='2']" />
    </property>  
</action>
Copy to Clipboard Toggle word wrap

Example 13.14. Sample Configuration XPATH (external)

<action process="split" name="ContentBasedRouter" 
    class="org.jboss.soa.esb.actions.ContentBasedRouter">
    <property name="cbrAlias" value="XPath"/>
    <property name="ruleSet" value="xpath-rules.properties"/>
    <property name="ruleReload" value="true"/>
    <property name="destinations">
        <route-to destination-name="express" service-category="ExpressShipping"                 
            service-name="ExpressShippingService"/>
        <route-to destination-name="normal" service-category="NormalShipping"  
            service-name="NormalShippingService"/>
    </property>
</action>
Copy to Clipboard Toggle word wrap
Regex is configured in exactly the same way as XPath. The only difference is the expressions are Regex expressions (instead of XPath expressions).

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat