1 Reply Latest reply on Mar 2, 2011 12:14 AM by tcunning

    Need assistance with simple ContentBasedRouter(CBR) ..

    heyyou

      I am trying to take the simple_cbr quickstart example and tweak to fit my XML data, not having much success.

       

      All I'm trying to accomplish is read an inbound JMS message that contains an XML payload.  Compare

      two values in the XML payload using xpath comparison.  If the values are equal, then print a message.

       

      jboss-esb.xml:

       

      <?xml version = "1.0" encoding = "UTF-8"?>

      <jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">

          <providers>

                <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">

       

                    <jms-bus busid="inbound">

                        <jms-message-filter

                            dest-type="QUEUE"

                            dest-name="queue/JMS.IN" />

                    </jms-bus>

                    <jms-bus busid="internal">

                        <jms-message-filter

                            dest-type="QUEUE"

                            dest-name="queue/ESB" />

                    </jms-bus>

                    <jms-bus busid="routeit">

                        <jms-message-filter

                            dest-type="QUEUE"

                            dest-name="queue/ROUTEIT" />

                    </jms-bus>

       

                </jms-provider>

            </providers>

       

      <services>

       

              <!--  ESB CBR Service -->

              <service

                      category="JMSRouterService"

                      name="SimpleListener"

                      description="JMS Router sample" >

       

              <listeners>

                  <jms-listener name="JMSgateway"

                                      busidref="inbound" is-gateway="true" />

       

                  <jms-listener name="JMSrouter"

                                      busidref="internal" />

       

              </listeners>

       

              <actions mep="OneWay">

       

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

                              name="ContentBasedRouter">

       

                      <property name="ruleSet" value="myrules.drl"/>

                      <property name="ruleLanguage" value="XPathLanguage.dsl"/>

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

                      <property name="destinations">

                              <route-to destination-name="routeIt1"

                                      service-category="doRouteCategory"

                                      service-name="doRouteService"/>

                       </property>

                      </action>

                  </actions>

              </service>

       

      <service

                    category="doRouteCategory"

                    name="doRouteService"

                    description="Matching Router Service">

       

              <listeners>

       

                  <jms-listener name="RouterGateway"

                                      busidref="routeit" />

       

              </listeners>

       

                    <actions mep="OneWay">

                      <action name="printMessage"

                              class="org.jboss.soa.esb.actions.SystemPrintln">

                            <property name="message" value="THERE IS A MATCH !!"/>

                            <property name="printfull" value="false"/>

                     </action>

       

                 </actions>

                  </service>

       

            </services>

       

      </jbossesb>

       

      myrules.drl:


      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.format.MessageType;

       

      expander XPathLanguage.dsl

       

      #declare any global variables here

      global java.util.List destinations;

       

      rule "Routing Rule using XPATH match1"

          when

              xpathEquals "/aa:bb/cc:dd", "/aa:bb/ee:ff"

       

          then

                      Log : "IT MATCHED #1 !!!";

                      Destination : "routeIt1";

      end

       

       

      XML data:

      <?xml version="1.0" encoding="UTF-8"?>

      <aa:bb>

      <cc:dd>100000.00</cc:dd>

      <ee:ff>100000.00</ee:ff>

       

       

      </aa:bb>

       

       

      =======

       

      With the above code, I get the following errors:

       

      WARN  [org.jboss.soa.esb.listeners.message.ActionProcessingPipeline] (pool-55-thread-1) No fault address defined for fault message! To: JMSEpr

      ....

      INFO  [org.jboss.soa.esb.client.ServiceInvoker] (pool-55-thread-1) Unresponsive EPR: JMSEpr ...

       

      If I change the destination-name from routeIt1 to routeIt in both the myrules.drl and jboss-esb.xml, I also will get the message.

       

      [org.jboss.soa.esb.actions.ContentBasedWiretap] (pool-52-thread-1) No rule destination(s) [routeIt] were matched, . Please fix your configuration and/or routing rules.


      ====

       

      Any insight into what this is not working?

       

      thank you