Using the ESB as a JMS Producer
This section describes how to configure the ESB Profile of WSO2 Enterprise Integrator (WSO2 EI) to send messages to a JMS Queue.
Â
Follow the steps below to configure the ESB Profile of WSO2 EIÂ to accept messages via HTTP, and send them to JMS queue. Â
Configure the ESB Profile of WSO2 EI with Apache ActiveMQ and set up the JMS Sender. For instructions, see Configure with ActiveMQ.Â
Start WSO2 EI Tooling and create a proxy service with the following configuration. See Creating a Proxy Service for instructions.
<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>
Proxy service configuration
- Within theÂ
inSequence
, theÂOUT_ONLYÂ
property is set toÂtrue
 to indicate that the message exchange is one-way. To send a message to a JMS queue, you should define a JMS connection URL (line numbers 7 in the configuration above) as the URL of the endpoint, which should 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 when you use the Message Broker Profile or when you use ActiveMQ.
Note
When entering the following JMS connection URLs in the Management Console, be sure to replace the '
&
' character in the endpoint URL with '&
' 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 when you use 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 when you use the Message Broker Profile
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
- Within theÂ
Send a message to the ESB by executing the following command from theÂ
<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.Â