Objective: Introduction to switching transports with proxy services. The JMS provider will be JBoss Messaging(JBM) (http://www.jboss.org/jbossmessaging/).
- Start the Axis2 server and deploy the SimpleStockQuoteService (Refer steps above)
- Download , install and start JBM server (http://www.jboss.org/jbossmessaging), and configure Synapse to listen on JBM (refer notes below)
Start the ESB configuration numbered 263: i.e. wso2esb-samples -sn 263. We need to configure the required queues in JBM. Add the following entry to JBM jms configuration inside file-config/stand-alone/non-clustered/jbm-jms.xml.
Once you started the JBM server with the above changes you'll be able to see the following on STDOUT.
You also need to copy the jbm-core-client.jar, jbm-jms-client.jar, jnp-client.jar(these jars are inside $JBOSS_MESSAGING/client folder) and jbm-transports.jar, netty.jar(these jars are from $JBOSS_MESSAGING/lib folder) jars from JBM into the $ESB_HOME/repository/components/lib directory. This was tested with JBM 2.0.0.BETA3
You need to add the following configuration for Axis2 JMS transport listener in axis2.xml found at repository/conf/axis2.xml.
Once you start ESB configuration 263 and request for the WSDL of the proxy service (http://localhost:8280/services/StockQuoteProxy?wsdl) you will notice that its exposed only on the JMS transport. This is because the configuration specified this requirement in the proxy service definition.
Before running the JMS client you need to open the build.xml ant script and uncomment the following block under the jmsclient target.
Now lets send a stock quote request on JMS, using the dumb stock quote client as follows:
On the ESB debug(you'll need to enable debug log in ESB) log you will notice that the JMS listener received the request message as:
Now if you examine the console running the sample Axis2 server, you will see a message indicating that the server has accepted an order as follows:
In this sample, the client sends the request message to the proxy service exposed over JMS in Synsape. Synapse forwards this message to the HTTP EPR of the simple stock quote service hosted on the sample Axis2 server. Note that the operation is out-only and no response is sent back to the client. The transport.jms.ContentType property is necessary to allow the JMS transport to determine the content type of incoming messages. With the given configuration it will first try to read the content type from the 'contentType' message property and fall back to 'application/xml' (i.e. POX) if this property is not set. Note that the JMS client used in this example doesn't send any content type information.
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 parameter elements on the proxy service definition to specify the destination and connection factory etc. For example: