JBossESBContentBasedRouting

    JBossESB - JBossESBEIP - Content Based Routing

    -


    Pattern Description

     

     

    A Content Based Router inspects the content of a message and based on it's findings it can route the message to one or

    more destinations. If none of the rules fires (no destinations found) then this will result in an error condition and the

    message is routed to the Dead Letter Service.

     

    Implementation

     

    You can plug in other engines but by default we use JBossRules as our evaluation engine. JBossRules is deployed to the ESB by default in the jbrules.esb archive. You can use standard rules language or use an XPath construct to evaluate XML messages. To use XPath you need to reference the XPathLanguage.dsl.

     

    Configuration

     

    We have a standard action called: org.jboss.soa.esb.actions.ContentBasedRouter. The configuration of the action looks like:

     

    ...
    <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">
        <property name="ruleSet" value="MyESBRules-XPath.drl"></property>
        <property name="ruleLanguage" value="XPathLanguage.dsl"></property>
        <property name="ruleReload" value="true"></property>
        <property name="destinations">
            <route-to destination-name="express" service-category="ExpressShipping" service-name="ExpressShippingService"></route-to>
            <route-to destination-name="normal" service-category="NormalShipping" service-name="NormalShippingService"></route-to>
        </property>
        <property name="object-paths">
            <object-path path="body.order" ></object-path>
            <object-path path="body.lineitem1"></object-path>
        </property> 
    </action>
    ...
    

    Attribute

    Required

    Description

    ruleSet

    yes

    Reference to the rule set that will be used

    ruleLanguage

    no

    Reference to a Domain Specific Language, can be XPathLanguage.dsl or your own custom language

    ruleReload

    no

    false by default, if set to true it will hot-deploy updated rules.

    destinations

    yes

    The name should be referenced in the ruleSet, while the service-category and service-name are used to lookup the right EPR in the registry.

    object-paths

    no

    Specifies the place of the object in the message.

     

    Note that JBossRules only deals with 'shallow' objects. So if in your rule you want to inspect an Order object which lives in the body of the message called "order", you will have specify adn object-path of "body.order".

     

    More information