This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Objective: Demonstrate the capability of working MSMQ transport messages.

Objective: Introduction to switching transports with proxy services

Prerequisites:

please make sure that the given MSMQ sample is ONLY working on windows environment, since 
it invokes Microsoft C++ API for MSMQ via JNI invocation.
  • Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps above).

  • Download axis2-transport-msmq-1.1.0-wso2v6.jar (click here for  64x  32x ) and place that in ESB_HOME/repository/components/dropins.

    • MSMQ bridging requires JNI invocation and we are shipping two dlls as required for 64bit and 32bit O/S, so make sure that you are downloading the correct one.
  • Please make sure MQ installed and running for more information please refer http://msdn.microsoft.com/en-us/library/aa967729.aspx.

  • Make sure that you have installed Visual C++ 2008 (VC9), it works with Microsoft Visual Studio 2008 Express.

For a default MSMQ v4.0 installation, you may place following in the Axis2 transport sender/ listener configuration at repository/conf/axis2/axis2.xml as,

<transportSender name="msmq"class="org.apache.axis2.transport.msmq.MSMQSender"/>
<transportReceiver name="msmq" class="org.apache.axis2.transport.msmq.MSMQListener">    
	<parameter name="msmq.receiver.host" locked="false">localhost</parameter>
</transportReceiver>

 

Synapse Configuration for MSMQ,

<proxy name="msmqTest" transports="msmq" startOnLoad="true">
	<target>
        <inSequence>
            <property name="OUT_ONLY" value="true"/>
            <send>
                <endpoint>
                	<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            	</endpoint>
        	</send>
        </inSequence>
       	<outSequence>
        	<send/>
    	</outSequence>
	</target>
</proxy>
<proxy name="StockQuoteProxy"  transports="http"   startOnLoad="true" trace="disable">
     <description/>
      <target>
        <endpoint>
          <address uri="msmq:DIRECT=OS:localhost\private$\msmqTest"/>
        </endpoint>
        <inSequence>
           <property name="FORCE_SC_ACCEPTED"  value="true"  scope="axis2"  type="STRING"/>
           <property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
        </inSequence>
       <outSequence>
          <log level="custom">
              <property name="MESSAGE" value="OUT SEQENCE CALLED"/>
          </log>
           <send/>
         </outSequence>
      </target>
      <publishWSDL uri="http://localhost:9000/services/SimpleStockQuoteService?wsdl"/>
 </proxy>

Invoke the sample as follows,

ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT

 

The sample Axis2 server console will print a message indicating that it has accepted the order as follows,

Accepted order for : 18406 stocks of MSFT at $ 83.58806051152119

Above samples works as follows,

  • Sending Place stockquote request to the ESB proxy.
  • Proxy sends the incoming message to the MSMQ server.

 msmq:DIRECT=OS:localhost\private$\msmqTest

  • Another proxy known as ' msmqTest' listening to the MSMQ queue, invoke the message from MSMQ and send to the Aix2 back-end server.

 

 

  • No labels