3 Replies Latest reply on Sep 5, 2011 6:56 AM by pete_p

    Content Base Routing

    pete_p

      Hi

       

      Following is a snippet from JBoss's Services_Guide.pdf. p37

      It is on the subject of Content based routing.

       

      <action class="org.jboss.soa.esb.actions.ContentBasedRouter" name="ContentBasedRouter">

           <property name="cbrAlias" value="XPath"/>

           <property name="ruleSet" value="/rules/xpath-rules.properties"/>

           <property name="ruleReload" value="true"/>

           <property name="destinations">

                <route-to destination-name="blue" service-category="BlueTeam" service-name="GoBlue" />

       

                <route-to destination-name="red" service-category="RedTeam" service-name="GoRed" />

       

                <route-to destination-name="green" service-category="GreenTeam" service-name="GoGreen" />

           </property>

      </action>

       

      Being new on this subject, I am trying to understand "how" the above actually works but struggling.

       

      As I understand, the listener picks up the ESB Message, which is "processed" by

      the class org.jboss.soa.esb.actions.ContentBasedRouter.

       

      What is not clear in the documentation. is exactly what the class ContentBasedRouter

      is doing.

      Can someone clarfy this for me please.

       

      Also is there a way I can get access to the source code for the ContentBasedRouter class.

       

      Finally, in the above, how and where is the contents of the ESB message interrogated to

      get the parameters held it. I guess this detail is in the ContentBasedRouter class.

       

      Great subject ... just can't my humble head round it.

       

      Thanks for any help

       

      Pete

        • 1. Re: Content Base Routing
          mmusaji

          I'm not an expert in this area but here's the source code you can have a look at it and hopefully will help you out a bit

           

          http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/ContentBasedRouter.java

          1 of 1 people found this helpful
          • 2. Re: Content Base Routing
            pete_p

            Hi,

             

            Nice link. I tried to follow the code which than required me to look for more implementation code etc.. until all I could get access to interfaces which obvioulsy didn't the detailed behaviour.

             

            So I think looking at source code is probably not this best thing on this occasion.

             

            To this end if any one can shed some word to explain the behaviour,  ie, how the ContentBasedRouter class knows

            about the parameters held in the ESB message;

             

            Many Thanks

             

            Pete

            • 3. Re: Content Base Routing
              pete_p

              Hi

              Kinda answering my own question... after further investigation.

               

              Any parametes ( class instances) required either in the java class or in the "drools" file are stored in the ESB message body

              by the caller.

              In the java class, the parameters can be read back from the ESB message body.

              In the drools file, any parameters used in a rule will be read from the ESB body and put into the variable ( $par) by the rule engine.

               

              Thats my understanding.

               

              Please clarify if I am wrong.

               

              Pete