This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

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 5 Next »

Objective: Demonstrate one way message bridging from JMS to HTTP using inbound JMS endpoint.

Prerequisites
  • Download and set up Apache ActiveMQ. Instructions can be found in section Installation Prerequisites. 
  • Copy the following client libraries from <AMQ_HOME>/lib directory to <ESB_HOME>/repository/components/lib directory. 

            ActiveMQ 5.8.0 and above 
    • activemq-broker-5.8.0.jar
    • activemq-client-5.8.0.jar
    • geronimo-jms_1.1_spec-1.1.1.jar
    • geronimo-j2ee-management_1.1_spec-1.0.1.jar
    • hawtbuf-1.9.jar 

          Earlier version of ActiveMQ

    • activemq-core-5.5.1.jar

    • geronimo-j2ee-management_1.0_spec-1.0.jar

    • geronimo-jms_1.1_spec-1.1.1.jar

  • Start the Axis2 server and deploy the SimpleStockQuoteService if not already done.
  • Start the Synapse configuration numbered 901: wso2esb-samples.sh -sn 901
 <definitions xmlns="http://ws.apache.org/ns/synapse">
   <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
      <parameter name="cachableDuration">15000</parameter>
   </registry>
   <taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager">
      <parameter name="cachableDuration">15000</parameter>
   </taskManager>
   <inboundEndpoint xmlns="http://ws.apache.org/ns/synapse" name="jms_inbound" sequence="request" onError="fault" protocol="jms" suspend="false">
      <parameters>
         <parameter name="interval">1000</parameter>
         <parameter name="transport.jms.Destination">ordersQueue</parameter>
         <parameter name="transport.jms.CacheLevel">1</parameter>
         <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
         <parameter name="sequential">true</parameter>
         <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
         <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
         <parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter>
         <parameter name="transport.jms.SessionTransacted">false</parameter>
         <parameter name="transport.jms.ConnectionFactoryType">queue</parameter>
      </parameters>
   </inboundEndpoint>
   <sequence name="request" onError="fault">
      <call>
         <endpoint>
            <address format="soap12" uri="http://localhost:9000/services/SimpleStockQuoteService"/>
         </endpoint>
      </call>
      <drop/>
   </sequence>
</definitions>
  • Log on to ActiveMQ console using url http://localhost:8161/admin
  • Browse the queue 'ordersQueue' listening by the above endpoint.
  • Add a new message with the following content to the queue.

    Message content is as follows:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <soapenv:Body>
        	<m0:getQuote xmlns:m0="http://services.samples"> 
            	<m0:request>
                	<m0:symbol>IBM</m0:symbol>
                </m0:request>
            </m0:getQuote>
        </soapenv:Body>
    </soapenv:Envelope>

This example will get the message from the queue and send to stockquote service.

 

  • No labels