Este conteúdo não está disponível no idioma selecionado.

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).

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat