Note that WSO2 EI is shipped with the following changes to what is mentioned in this documentation:
repository/samples/directory that includes all Integration profile samples is changed to
repository/samples/resources/directory that includes all artifacts related to the Integration profile samples is changed to
This sample demonstrates how the ESB receives a messages over the JMS transport and forwards it over a HTTP/S transport.. In this sample, the client sends a request message to the proxy service exposed in JMS. The ESB forwards this message to the HTTP EPR of the simple stock quote service hosted on the sample Axis2 server, and returns the reply back to the client through a JMS temporary queue.
Configure WSO2 ESB's JMS transport with ActiveMQ and enable the JMS transport listener and sender. For information on how to configure with ActiveMQ, and how to enable the JMS transport listener and sender, see Configure with ActiveMQ.
If you are using ActiveMQ version 5.8.0 or above, you need to copy the hawtbuf-1.2.jar file from the
<ActiveMQ>/libdirectory to the
- For a list of prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:
This configuration file
synapse_sample_250.xml is available in the
To build the sample
Start the ESB with the sample 250 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Now you have a running ESB instance and a back-end service deployed. In the next section, we will send a message to the back-end service through the ESB using a sample client.
Executing the sample
To execute the sample JMS client
Run the following command from the
Analyzing the output
When you run the client and analyze the ESB debug log, you will see the following entry, which shows that the JMS listener received the request message:
When you run the client, it sends a plain XML formatted place order request to a JMS queue named
StockQuoteProxy. The ESB polls on this queue for any incoming messages and picks up the request. If you run the ESB in the DEBUG mode, you will see the following entry on the console.
Then, the ESB mediated the request and forwards it to the sample Axis2 server over HTTP. If you analyze the console running the sample Axis2 server, you will see the following message indicating that the server has accepted an order:
It is possible to instruct a JMS proxy service to listen to an already existing destination without creating a new one. To do this, use the property elements on the proxy service definition to specify the destination and connection factory.