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/.

WSO2 EI as a JMS Producer

This section describes how to configure WSO2 Enterprise Integrator (WSO2 EI) to send messages to a JMS Queue.

 

Follow the steps below to configure WSO2 EI  to accept messages via HTTP and send them to JMS queue.  

  1. Configure WSO2 EI with Apache ActiveMQ and set up the JMS Sender. For instructions, see Configure with ActiveMQ. 

  2. Create a proxy service with the following configuration. To create a proxy service using Tooling, see Working with Proxy Services via Tooling.

    See below, for details on how to define the JMS endpoint in the proxy configuration.

    <proxy xmlns="http://ws.apache.org/ns/synapse" name="StockQuoteProxy" transports="http">
        <target>
            <inSequence>
                <property action="set" name="OUT_ONLY" value="true"/>
                <send>
                    <endpoint>
                        <address uri=""/> <!-- Specify the JMS connection URL here -->
                    </endpoint>
                </send>
            </inSequence>
            <outSequence/>
        </target>
        <publishWSDL uri="file:samples/service-bus/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>

    Within the inSequence, the OUT_ONLY property is set to true to indicate that message exchange is one-way.

  3. Send a message to ESB by executing the following command from <EI_HOME>/samples/axis2Client folder.


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

    You can view the ActiveMQ queue by accessing the ActiveMQ management console using the URL http://0.0.0.0:8161/admin and using admin as both the username and password.  

JMS Connection URL

To send a message to a JMS queue, we define a JMS connection URL (line numbers 7 in the configuration above) as the URL of the endpoint, which will be invoked via the send mediator.

You can define a JMS queue name and connection factory parameters in the JMS connection URL. Values of connection factory parameters depend on the type of the JMS broker. Listed below are examples of how the JMS connection URL can be defined for WSO2 Message Broker and for ActiveMQ.

Note

When entering the following JMS connection URLs in the Management Console, be sure to replace the '&' character in the endpoint URL with '&amp;' to avoid the following exception:

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '=' (code 61); expected a semi-colon after the reference for entity 'java.naming.factory.initial' at [row,col {unknown-source}
Example JMS connection URL for ActiveMQ
jms:/SimpleStockQuoteService?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue
Example JMS connection URL for WSO2 Message Broker
jms:/StockQuotesQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=conf/jndi.properties&transport.jms.DestinationType=queue