2 Replies Latest reply on Jan 1, 2009 7:41 AM by marklittle

    Content Based routing using drools

      I want to perform Content Based Routing. I am sending a string in my message and i want to route on basis of string value.

      My string value resides in default entry of jboss .I need to write rule for mapping this string to some value.

      Please tell me how would i write such rule that picks up the default entry of Message body.

        • 1. Re: Content Based routing using drools

          Neha, i have implemented this using drools.
          Here on the basis of message property i am routing my message to different services. Please have a look if it can help you.

          #created on: Oct 30, 2006
          package com.jboss.soa.esb.routing.cbr
          
          #list any import classes here.
          import org.jboss.soa.esb.message.Message;
          import org.jboss.soa.esb.message.Properties;
          
          #declare any global variables here
          global java.util.List destinations;
          
          rule "FTPService Rule"
           when
           m : Message()
           props : Properties() from m.getProperties()
           eval(props.getProperty("CommunicationMode").equals("FTP"))
           then
           System.out.println("#########Inside FTPService Rule#########");
           destinations.add("FTP-destination");
          end
          
          rule "SMTPService Rule"
           when
           m : Message()
           props : Properties() from m.getProperties()
           eval(props.getProperty("CommunicationMode").equals("SMTP"))
           then
           System.out.println("#######Inside SMTPService Rule#########");
           destinations.add("SMTP-destination");
          end
          


          This is the code from jboss-esb.xml
          <action name="routingAction" class="org.jboss.soa.esb.actions.ContentBasedRouter">
          <property name="ruleSet" value="RoutingRules.drl"/>
          <property name="ruleReload" value="true"/>
          <property name="destinations">
           <route-to destination-name="FTP-destination" service-category="FTPServiceESBCategory" service-name="FTPServiceESB" />
           <route-to destination-name="SMTP-destination" service-category="SMTPServiceESBCategory" service-name="SMTPServiceESB" />
          </property>
          </action>
          


          • 2. Re: Content Based routing using drools
            marklittle

            Don't forget you can always provide code drops for others in the community by putting them in the sandbox.