This sample demonstrates how the ESB performs transport switching between JMS and HTTP, and also demonstrates how to configure a one-way HTTP proxy.
Configure WSO2 ESB's JMS transport with ActiveMQ and enable the JMS transport listener. For information on how to configure WSO2 ESB's JMS transport with ActiveMQ, 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_253.xml is available in the
To build the sample
Start the ESB with the sample 253 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
This example invokes the one-way
placeOrder operation on the
SimpleStockQuoteService using the Axis2
ServiceClient.fireAndForget() API at the client. To test this, run the the following command from the
To test how the ESB responds with a HTTP 202 Accepted response to a request received, run the the following command from the
Analyzing the output
When you run the first command specified above, you will see the one-way JMS message flowing through the ESB into the sample Axis2 server instance over HTTP, and you will also see how Axis2 acknowledges it with a HTTP 202 Accepted response.
When you run the next command, you will see that the proxy service simply logs the message received and acknowledges it. On the ESB console you will see the logged message, and if TCPMon is used at the client, you will also see the 202 Accepted response that is sent back to the client from the ESB.