Tuesday, May 15, 2012

MSMQ transport for WSO2 ESB


MSMQ transport for WSO2 ESB



After a long research and some experimentation, I was able to complete MSMQ Adapter for WSO2 ESB It's still in the experimental stage (meaning that the code is not released, not QAed , not much feature support). But thought of releasing a un official un QAed version which has developed where currently its only support text/xml message format though there will be a plan to extend the functionality to support binary message as well.
The aim of the MSMQ transport is to connect to a MSMQ broker running on a Windows machine. Microsoft Message Queuing or MSMQ is the message queueing implementation developed by Microsoft. And it's distributed as a part of their operating system. So you can use this transport to connect to a MSMQ from WSO2 ESB.
MSMQ has a API for C/C++, so that C/C++ programs can use the broker functionality. The bride that was used which connect the Java programs to MSMQ C/C++ APIis the library developed by Dino Chiesa ( This is a summary of the usage of the library).



2) Download MSMQ transport adapter jar (axis2-transport-msmq-1.1.0-wso2v4.jar) from the following location (https://svn.wso2.org/repos/wso2/people/dushan/msmq/target/) and copy to ESB_HOME/repository/components/dropins

3.) Open axis2.xml and provide following add following transport sender and listener information


    <!-- MSMQ Configuration  -->
     <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>


4.) Start WSO2 ESB create 2 new proxies as described defined below, please note the highlighted text where those are the necessary configurations in order to access 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">
        <target>
            <endpoint>
                <address uri="msmq:DIRECT=OS:localhost\private$\msmqTest"/>
            </endpoint>
            <inSequence>
                <property name="OUT_ONLY" value="true"/>
            </inSequence>
            <outSequence>
                <drop/>
            </outSequence>
        </target>
    </proxy>



5.) Setup Back end services (which is already available under ESB samples), and using command line send stockequate request to the ESB

















Conclusion
As mention this is still in a experimental stage where  remaining goals are to verify the transaction management over messages, and to support binary messages, 





























No comments:

Post a Comment