Skip to content

Switching between HTTP and MSMQ

This example demonstrates how you can use the Micro Integrator to switch messages between HTTP and MSMQ during message mediation.

In this example, stockquote requests are placed to the stockquote proxy service, which send the incoming request message to the MSMQ server. Another proxy service named msmqTest listens to the MSMQ queue and invokes the message from the MSMQ server and sends the message to the backend.

Synapse configuration

<proxy xmlns="http://ws.apache.org/ns/synapse" 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>
        <parameter name="transport.msmq.ContentType">application/xml</parameter>
    </target>
</proxy>
<proxy xmlns="http://ws.apache.org/ns/synapse" 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>
Top