JBossESB - JBossESBEIP - Content Based Routing
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.
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.
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> ...
Reference to the rule set that will be used
Reference to a Domain Specific Language, can be XPathLanguage.dsl or your own custom language
false by default, if set to true it will hot-deploy updated rules.
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.
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".