Content-based routing
ddunkin Jul 17, 2006 1:49 PMI would like to work on defining how we can do content based routing. I have developed an inhouse ESB that includes a content based routing function, so I do have some insight in this area.
In our inhouse system, we have many adapter components that plug into a core. These adapters may handle specific types of input documents (e.g. an Ariba OrderRequest document) or a range of documents. Our system uses OAGIS, an XML "business language," as the common language for the system, so all messages are converted to OAGIS documents if they're not already in that format.
Here's where the content-based routing comes in. The adapter components in our ESB are deployed with a set of routing rules. These rules basically say "for a document matching this XPath expression, send the document to this location (an instance of an adapter component bound in the JNDI tree)." We use drools 2.1 and a simple custom DSL. Here are a few examples of rulesets:
<rule-set name="NDSRoutingRules" xmlns="http://drools.org/rules" xmlns:rr="http://www.dis-corp.com/xml/ebiz/routing/dsl/1.0" xmlns:ebiz="http://www.dis-corp.com/xml/ebusiness/2.0" xmlns:oa="http://www.openapplications.org/oagis/9"> <rule name="ProcessRFQ_to_dealer"> <rr:matches>/ebiz:ProcessRFQ/oa:DataArea/oa:RFQ/oa:RFQHeader/oa:SupplierParty/oa:PartyIDs/oa:ID[@schemeURI='http://www.dis-corp.com/xml/ebusiness/2.0/dealer']</rr:matches> <rr:destination> <rr:var name="dealerId">/ebiz:ProcessRFQ/oa:DataArea/oa:RFQ/oa:RFQHeader/oa:SupplierParty/oa:PartyIDs/oa:ID[@schemeURI='http://www.dis-corp.com/xml/ebusiness/2.0/dealer']</rr:var> <rr:template>dealers/{dealerId}/ebiz1</rr:template> </rr:destination> </rule> </rule-set>
<rule-set name="KomatsuPartsAvailabilityRoutingRules" xmlns="http://drools.org/rules" xmlns:rr="http://www.dis-corp.com/xml/ebiz/routing/dsl/1.0" xmlns:ebiz="http://www.dis-corp.com/xml/ebusiness/2.0" xmlns:oa="http://www.openapplications.org/oagis/9"> <rule name="Rule"> <rr:equals> <rr:path>/ebiz:ProcessRFQ/oa:DataArea/oa:RFQ/oa:RFQHeader/oa:SupplierParty/oa:PartyIDs/oa:ID[@schemeURI='http://www.dis-corp.com/xml/ebusiness/2.0/services']</rr:path> <rr:value>komatsu-pa</rr:value> </rr:equals> <rr:destination> <rr:template>services/komatsu/PartsAvailability</rr:template> </rr:destination> </rule> </rule-set>
So for us, the requirement of content-based routing is pretty simple: be able to determine destination address of a message from an XPath expression. Does anyone else have examples of how they would like content-based routing to work?
I would like to start playing around with the existing routing in JBossESB, but I haven't been able to find the code that actually does any sort of routing. Can someone point me in the right direction? Thanks.
Dave D.