All docs This doc

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • 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: -sn 901
Code Block

This example invokes the one-way placeOrder operation on the SimpleStockQuoteService using the Axis2 ServiceClient.fireAndForget() API at the client. To test this, use ant -Dmode=placeorder... and you will notice the one way JMS message flowing through ESB into the sample Axis2 server instance over HTTP, and Axis2 acknowledging it with a HTTP 202 Accepted response.

Code Block
ant stockquote -Dmode=placeorder -Dtrpurl="jms:/JMStoHTTPStockQuoteProxy?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory& <definitions xmlns="">
   <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
      <parameter name="cachableDuration">15000</parameter>
   <taskManager provider="org.wso2.carbon.mediation.ntask.NTaskTaskManager">
      <parameter name="cachableDuration">15000</parameter>
   <inboundEndpoint xmlns="" name="jms_inbound" sequence="request" onError="fault" protocol="jms" suspend="false">
         <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">org.apache.activemq.jndi.ActiveMQInitialContextFactory&ActiveMQInitialContextFactory</parameter>
         <parameter name="java.naming.provider.url=tcp">tcp://localhost:61616&61616</parameter>
         <parameter name="transport.jms.SessionAcknowledgement">AUTO_ACKNOWLEDGE</parameter>
         <parameter name="transport.jms.ContentTypeProperty=Content-Type&transport.jms.DestinationType=queue"
Code Block
SimpleStockQuoteService :: Accepted order for : 7482 stocks of IBM at $ 169.27205579038733

The second example shows how ESB can be made to respond with a HTTP 202 Accepted response to a request received. The Proxy Service simply logs the message received and acknowledges it. On the ESB console you could see the logged message, and if TCPMon was used at the client, you would see the 202 Accepted response sent back to the client from ESB.

Code Block
ant stockquote -Dmode=placeorder -Dtrpurl=http://localhost:8280/services/OneWayProxy
Code Block
HTTP/1.1 202 Accepted
Content-Type: text/xml; charset=UTF-8
SOAPAction: "urn:placeOrder"
Date: Sun, 06 May 2007 17:20:19 GMT
Server: Synapse-HttpComponents-NIO
Transfer-Encoding: chunked

         <parameter name="transport.jms.ConnectionFactoryType">queue</parameter>
   <sequence name="request" onError="fault">
            <address format="soap12" uri="http://localhost:9000/services/SimpleStockQuoteService"/>
  • 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:

    Code Block
    <soapenv:Envelope xmlns:soapenv="" xmlns:wsa="">
        	<m0:getQuote xmlns:m0="http://services.samples"> 

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



Example of bridging from JMS to HTTP and replying with a 202 Accepted response in WSO2 ESBusing inbound JMS protocol.