Hi,

Setup ESB 4.8.1 + MB 2.2.0 (3 Queues namely; UC7_QueueListnerProxy,
javaVendor, otherVendor)

During a demonstration we were successfully able to define the rule set
in-line [2] using a Rule Mediator.
But when we try to upload the contents as messageRoutingRules.xml [4] file
into registry and access rule set via Registry Lookup [1]
we are getting a null pointer [3].

Where can we find a sample registry rule set xml file content?

Please note that in ESB documentation [1] sample.xml file content is not
provided.

[1] https://docs.wso2.com/display/ESB481/Rule+Mediator
[2]
<proxy name="UC7_QueueListnerProxy"
          transports="https http jms"
          startOnLoad="true"
          trace="disable">
      <description/>
      <target>
         <inSequence>
            <log level="full"/>
            <rule xmlns="http://wso2.org/carbon/rules";>
               <source>soapBody</source>
               <target action="replace"
resultXpath="//accept/child::text()">$accept</target>
               <ruleSet>
                  <properties/>
                  <rule resourceType="regular" sourceType="inline">
                         package SimpleRoutingRules;

                        rule "Invoke IBM" no-loop true
                        when
                        symbol: String() eval( symbol.equals("IBM") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"javaVendorEndPoint");
                        end

                        rule "Invoke SUN" no-loop true
                        when
                        symbol: String() eval( symbol.equals("SUN") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"javaVendorEndPoint");
                        end

                        rule "Invoke MFST" no-loop true
                        when
                        symbol: String() eval( symbol.equals("MFST") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"otherVendorEndPoint");
                        end

</rule>
               </ruleSet>
               <input namespace="http://services.samples";
wrapperElementName="getQuote">
                  <fact xmlns:m0="http://services.samples";
                        elementName="symbol"
                        namespace="http://services.samples";
                        type="java.lang.String"

xpath="//m0:getQuote/m0:request/m0:symbol/child::text()"/>
               </input>
               <output namespace="http://services.samples";
                       wrapperElementName="getQuoteRespone">
                  <fact elementName="accept" namespace=""
type="java.lang.String"/>
               </output>
            </rule>
            <log level="custom">
               <property xmlns:m0="http://services.samples";
                         name="*********** Message Payload "

 expression="//m0:getQuote/m0:request/m0:symbol/child::text()"/>
            </log>
            <switch source="get-property('accept')">
               <case regex="javaVendorEndPoint">
                  <log level="custom">
                     <property name="*********** Endpoint Located for
Vendor "
                               value="javaVendorEndPoint"/>
                  </log>
                  <log level="custom">
                     <property name="*********** Sending Message to Queue "
value="javaVendor"/>
                  </log>
                  <property name="OUT_ONLY" value="true"/>
                  <send>
                     <endpoint>
                        <address
uri="jms:/javaVendor?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/jndi.properties&amp;transport.jms.DestinationType=queue"/>
                     </endpoint>
                  </send>
               </case>
               <case regex="otherVendorEndPoint">
                  <log level="custom">
                     <property name="*********** Endpoint Located for
Vendor "
                               value="otherVendorEndPoint"/>
                  </log>
                  <log level="custom">
                     <property name="*********** Sending Message to Queue "
value="otherVendor"/>
                  </log>
                  <property name="OUT_ONLY" value="true"/>
                  <send>
                     <endpoint>
                        <address
uri="jms:/otherVendor?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=repository/conf/jndi.properties&amp;transport.jms.DestinationType=queue"/>
                     </endpoint>
                  </send>
               </case>
            </switch>
            <drop/>
         </inSequence>
      </target>
      <parameter name="transport.jms.ContentType">
         <rules>
            <jmsProperty>contentType</jmsProperty>
            <default>application/xml</default>
         </rules>
      </parameter>
   </proxy>

[3]
[2015-04-29 10:46:31,861]  INFO - LogMediator To: , WSAction: urn:mediate,
SOAPAction: urn:mediate, MessageID:
ID:13a1befb-c725-3f04-9c92-a05a5d7c5b5d, Direction: request, Envelope:
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><m:getQuote
xmlns:m="http://services.samples";>
    <m:request>
        <m:symbol>IBM</m:symbol>
    </m:request>
</m:getQuote></soapenv:Body></soapenv:Envelope>
[2015-04-29 10:46:31,908]  INFO - LogMediator *********** Message Payload
 = IBM
[2015-04-29 10:46:31,912]  WARN - SwitchCase Provided character sequence
for switch case condition is 'null'. Switch case will not be executed.
[2015-04-29 10:46:31,912]  WARN - SwitchCase Provided character sequence
for switch case condition is 'null'. Switch case will not be executed.

[4]  messageRoutingRules.xml file content
package SimpleRoutingRules;

                        rule "Invoke IBM" no-loop true
                        when
                        symbol: String() eval( symbol.equals("IBM") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"javaVendorEndPoint");
                        end

                        rule "Invoke SUN" no-loop true
                        when
                        symbol: String() eval( symbol.equals("SUN") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"javaVendorEndPoint");
                        end

                        rule "Invoke MFST" no-loop true
                        when
                        symbol: String() eval( symbol.equals("MFST") )
                        then

 update(drools.getWorkingMemory().getFactHandle(symbol),"otherVendorEndPoint");
                        end

Thanks,
Suhan

-- 
Suhan Dharmasuriya
Software Engineer - Test Automation

*WSO2, Inc. *

lean . enterprise . middleware
Tel: +94 112 145345
Mob: +94 779 869138
Blog: http://suhan-opensource.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to