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/.
Configure with IBM WebSphere MQ
The WSO2 JMS transport can be configured with IBM® WebSphere® MQ. The following topics cover the configuration steps.
Note
Prerequisites
- WSO2 ESB is installed. To test the samples, you must also have Apache Ant installed. For details, see Installation Prerequisites.
- WebSphere MQ is installed and the latest fix pack applied (see the IBM documentation). The fix pack can be obtained from http://www-01.ibm.com/software/integration/wmq.
Configuring WebSphere MQ
Follow the instructions below to configure WebSphere MQ.
Configuring JSAdmin.conf File
1. Go to /Java/bin directory and open the JSAdmin.config file in a text editor.
2. Comment out the existing INITIAL_CONTEXT_FACTORY and add a INITIAL_CONTEXT_FACTORY named com.sun.jndi.fscontext.RefFSContextFactory.
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
3. Comment out the default PROVIDER_URL and use a directory path instead. Ensure the directory is created in the file system (e.g., C:/JNDI-Directory).
Note
Your JSAdmin.config file should now look similar to this:
# appropriate one should be uncommented. # #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WMQInitialContextFactory # # The following line specifies the URL of the service provider's initial # context. It currently refers to an LDAP root context. Examples of a # file system URL and WebSphere's JNDI namespace are also shown, commented # out. # #PROVIDER_URL=ldap://polaris/o=ibm,c=us PROVIDER_URL=file:/C:/JNDI-Directory #PROVIDER_URL=iiop://localhost/ #PROVIDER_URL=localhost:1414/SYSTEM.DEF.SVRCONN ......
4. Restart the WebSphere MQ service.
Creating the Queue in WebSphere MQ
1. Start IBM WebSphere MQ Explorer and create a new queue manager. Make sure you select make this the default queue manager check box. Leave default values on the other fields.
2. Select the options to Start Queue Manager, Autostart Queue Manager, and Create server connection channel, and then click Next.
3. Select the option to create a listener configuration for TCP/IP, and provide a port number ( e.g., 1415 ).
4. Select the created Queue manager and expand its navigation tree. Click Queues in the tree and create a new local queue (e.g., localq).
5. Keep the default configurations and click Finish.
6. Click Topics in the tree view and create a new local topic (e.g., localt).
7. Right-click Channels under Advanced and select New > Server-connection Channel. Provide a name for the channel (e.g., myChannel), and click Next.
8. Set the transmission protocol as TCP and click Finish.
A listener is created and is running on the given port (e.g., 1415). You should be able to view it by clicking the listeners icon.
Generating the .bindings File
1. Go to <WebSphere_MQ_HOME> /java/bin directory, and invoke the IVT app by running the following command:
IVTRun.bat -nojndi -client -m mymgr -host localhost -channel mychannel
2. Create the default set of JNDI bindings by running the following command on the command prompt:
IVTSetup.bat
3. Execute the IVTRun tool as follows.
IVTRun.bat -url "file:/C:/JNDI-Directory" -icf com.sun.jndi.fscontext.RefFSContextFactory
4. You have now enabled and verified JNDI support. Now go to C:/JNDI-Directory to view the .bindings file there.
5. Start the JMSAdmin tool by running the jmsadmin.bat file.
6. Modify the JNDI bindings by executing the following commands:
For queues:
ALTER QCF(ivtQCF) TRANSPORT(CLIENT) ALTER QCF(ivtQCF) QMGR(mymgr)
For topics:
ALTER TCF(ivtTCF) TRANSPORT(CLIENT) ALTER TCF(ivtTCF) QMGR(mymgr)
7. In IBM WebSphere MQ Explorer, select JMS Administered Objects from the tree view on the left, and then select Add initial context. Once done, select File system and enter the JNDI directory path. This will bring up all created queues and topics.
You have now set up and configured IBM WebSphere MQ in your environment.
Configuring WSO2 ESB
Follow the instructions below to configure WSO2 ESB.
1. If you set up WSO2 ESB on a different machine from WebSphere MQ, copy C:/JNDI-Directory to that machine. The bindings file allows you to access WebSphere queues from any machine in the network.
2. Copy the following jar files from <WebSphere_MQ_HOME>/java/lib directory to <ESB_HOME>/repository/components/lib directory.
- com.ibm.mqjms.jar
- fscontext.jar
- providerutil.jar
- com.ibm.mq.jmqi.jar
- dhbcore.jar
3. If you are using WebSphere MQ version 6.0 instead of version 7.0, add the following two jar files. You might not find com.ibm.mq.jmqi.jar in version 6.0.
- com.ibm.mq.jar
- connector.jar
Optionally, you might have to add the following jars as well.
- jms.jar
- jndi.jar
- jta.jar
- ldap.jar
4. Log in to the JMSAdmin tool and create a queue named bogusq by running the following commands in JMSAdmin shell.
DEFINE Q(bogusq) QMGR(mymgr) ALTER Q(bogusq) QUEUE(localq)
Note that localq is the queue we created earlier. We use two queues for the queue scenario, and the queue named bogusq is defined as the default destination since we need the default queue ( ivtQ ) for our proxy service only. If we use ivtQ here, all the services deployed in ESB (XKMS, echo, wso2carbon-sts etc.) will start listening on the same queue.
5. Repeat these steps for the topic scenarios. For example:
DEFINE T(bogust) ALTER T(bogust) TOPIC(localt)
Note that localt is the topic we created earlier.
6. Configure the <ESB_HOME>\repository\conf\axis2.xml file as follows:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
You will comment and uncomment the non-default connection factories depending on which scenario you are running, as described in the next section.
Sample Scenarios
This section describes how to configure the following sample scenarios using the JMS transport, WebSphere MQ, and WSO2 ESB:
- Queue Scenario 1: JMS Client -> Queue -> ESB -> Axis2server
- Queue Scenario 2: JMS Client -> ESB -> Queue -> Axis2server
- Topic Scenario 1: JMS Client -> Topic -> ESB -> Axis2server
- Topic Scenario 2: JMS Client -> ESB -> Topic -> Axis2server
In scenarios where the client places the message directly on the queue or topic, and the message is then picked up by the ESB, you configure the non-default connection factories in <ESB_HOME>\repository\conf\axis2.xml and comment them out in the \samples\axis2Server\repository\conf\axis2.xml file. In scenarios where the client sends the message to the ESB first, and the ESB places the message on the queue or topic, you configure the non-default connection factories in \samples\axis2Server\repository\conf\axis2.xml and comment them out in <ESB_HOME>\repository\conf\axis2.xml.
Queue Scenario 1: Client to Queue to ESB
In this scenario, the JMS client places an order on the ivtQ queue. The ESB listens on this queue, gets the message, and sends it to the back-end server to process.
In <ESB_HOME>\repository\conf\axis2.xml , comment out the myTopicConnectionFactory parameter and uncomment the SQProxyCF parameter. It should now look like this:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
If you are using version 6.0 of IBM WebSphere MQ, also add the following parameter to axis2.xml to ensure JMS Spec version 1.0.2b is used instead of version 1.1:
<parameter name="transport.jms.JMSSpecVersion">1.0.2b</parameter>
Start the ESB using Sample 250 by running the following command:
wso2esb-samples.bat -sn 250
Log in to the server management console at: https://localhost:9443/carbon/
Select web services -> list -> StockQuoteProxy -> edit (Specific Configuration)
Add a Service Parameter as follows and save it:
name = transport.jms.ConnectionFactory value = SQProxyCF
Go to the SYNAPSE_HOME/samples/axis2Client directory and build it using the "ant" command.
Go to the SYNAPSE_HOME/samples/axis2Client/src/samples/userguide directory, open the GenericJMSClient.java source file, and make the following changes in the code:
Set the jms_dest property default value to "ivtQ" (line 45)
Set the java.naming.provider.url to "file:/D:/JNDI-Directory" (line 82)
Set the java.naming.factory.initial to "com.sun.jndi.fscontext.RefFSContextFactory" (line 85)
Set the lookup key to "ivtQCF" (line 89)
Configure the proxy configuration so that it appears as follows:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <inSequence> <property name="OUT_ONLY" value="true"/> </inSequence> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> <parameter name="transport.jms.ContentType"> <rules> <jmsProperty>contentType</jmsProperty> <default>application/xml</default> </rules> </parameter> <parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter> </proxy> <sequence name="fault"> <log level="full"> <property name="MESSAGE" value="Executing default "fault" sequence"/> <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/> <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/> </log> <drop/> </sequence> <sequence name="main"> <log/> <drop/> </sequence> </definitions>
Configure \samples\axis2Server\repository\conf\axis2.xml so that it looks as follows:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the axis2 Server with the following command:
axis2Server.bat
Send the request from the JMS client, and the sample Axis2 server console will print a message:
ant jmsclient -Djms_type=pox -Djms_dest=ivtQ -Djms_payload=MSFT
Queue Scenario 2: Client to ESB to Queue
In this scenario, the JMS client places an order to the ESB, which then places it on the queue. The back-end server listens on this queue, and then gets the message and processes the request.
In <ESB_HOME>\repository\conf\axis2.xml, comment out both the myTopicConnectionFactory parameter and the SQProxyCF parameter. It should now look like this:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the ESB using Sample 251 with the following command:
wso2esb-samples.bat -sn 251
- Log into the ESB server management console at: https://localhost:9443/carbon/
- Select Service Bus -> Source view and update the JMS URL as follows:
jms:/ivtQ?transport.jms.ConnectionFactoryJNDIName=ivtQCF&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/D:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue &transport.jms.Destination=ivtQ
Configure the proxy service so it appears as follows:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable"> <target> <endpoint> <address uri="jms:/ivtQ?transport.jms.ConnectionFactoryJNDIName=ivtQCF&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/D:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue&transport.jms.Destination=ivtQ"/> </endpoint> <inSequence> <property name="TRANSPORT_HEADERS" scope="axis2" action="remove"/> <property name="OUT_ONLY" value="true"/> </inSequence> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> </proxy> <sequence name="fault"> <log level="full"> <property name="MESSAGE" value="Executing default "fault" sequence"/> <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/> <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/> </log> <drop/> </sequence> <sequence name="main"> <log/> <drop/> </sequence> </definitions>
Comment out myTopicConnectionFactory and uncomment SQProxyCF in the \samples\axis2Server\repository\conf\axis2.xml file as follows:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the axis2 Server with the following command:
axis2Server.bat
Add the following parameters to service.xml in the \samples\axis2Server\repository\services\SimpleStockQuoteService.aar:
<parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter>
Send the request from the JMS client, and the sample Axis2 server console will print a message as follows:
ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT
Topic Scenario 1: Client to Topic to ESB
In this scenario, the JMS client places an order on the topic ivtT. The ESB listens to this topic, gets the message, and sends it to the back-end server to process the request.
In <ESB_HOME>\repository\conf\axis2.xml , uncomment the myTopicConnectionFactory parameter and comment out the SQProxyCF parameter. It should now look like it did when you originally configured it
Start the ESB using Sample 250 by running the following command:
wso2esb-samples.bat -sn 250
Log in to the server management console at: https://localhost:9443/carbon/
Select web services -> list -> StockQuoteProxy -> edit (Specific Configuration)
Add a Service Parameter as follows and save it:
name = transport.jms.ConnectionFactory value = myTopicConnectionFactory
Go to the SYNAPSE_HOME/samples/axis2Client directory and build it using the "ant" command.
Go to the SYNAPSE_HOME/samples/axis2Client/src/samples/userguide directory, open the GenericJMSClient.java source file, and make the following changes in the code:
Set the jms_dest property default value to "ivtT" (line 45)
Set the java.naming.provider.url to "file:/D:/JNDI-Directory" (line 82)
Set the java.naming.factory.initial to "com.sun.jndi.fscontext.RefFSContextFactory" (line 85)
Set the lookup key to "ivtTCF" (line 89)
Configure the proxy configuration so that it appears as follows:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <inSequence> <property name="OUT_ONLY" value="true"/> </inSequence> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> <parameter name="transport.jms.ContentType"> <rules> <jmsProperty>contentType</jmsProperty> <default>application/xml</default> </rules> </parameter> <parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter> </proxy> <sequence name="fault"> <log level="full"> <property name="MESSAGE" value="Executing default "fault" sequence"/> <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/> <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/> </log> <drop/> </sequence> <sequence name="main"> <log/> <drop/> </sequence> </definitions>
Comment out the non-default connection factories in the \samples\axis2Server\repository\conf\axis2.xml file so that it looks as follows:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the axis2 server with the following command:
axis2Server.bat
Send the request from the JMS client, and the sample Axis2 server console will print a message.
Topic Scenario 2: Client to ESB to Topic
In this scenario, the JMS client sends an order to the ESB, which places it on the topic ivtT. The back-end server listens on this topic, and then gets the message and processes the request.
In <ESB_HOME>\repository\conf\axis2.xml , comment out the non-default connection factories as follows:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <!--parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter--> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the ESB using Sample 251 with the following command:
wso2esb-samples.bat -sn 251
Log into the ESB server management console at: https://localhost:9443/carbon/
Select Service Bus -> Source view, and in the JMS URL, change transport.jms.DestinationType to
topic.
Add the following parameters to service.xml in the \samples\axis2Server\repository\services\SimpleStockQuoteService.aar:
<parameter name="transport.jms.ConnectionFactory">myTopicConnectionFactory</parameter> <parameter name="transport.jms.Destination">ivtT</parameter>
Configure the proxy service so that it appears as follows:
<definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable"> <target> <endpoint> <address uri="jms:/ivtT?transport.jms.ConnectionFactoryJNDIName=ivtTCF&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/D:/JNDI-Directory&transport.jms.DestinationType=topic&transport.jms.ConnectionFactoryType=topic&transport.jms.Destination=ivtT"/> </endpoint> <inSequence> <property name="TRANSPORT_HEADERS" scope="axis2" action="remove"/> <property name="OUT_ONLY" value="true"/> </inSequence> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/> </proxy> <sequence name="fault"> <log level="full"> <property name="MESSAGE" value="Executing default "fault" sequence"/> <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/> <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/> </log> <drop/> </sequence> <sequence name="main"> <log/> <drop/> </sequence> </definitions>
In \samples\axis2Server\repository\conf\axis2.xml, uncomment myTopicConnectionFactory and comment out SQProxyCF:
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <parameter name="myTopicConnectionFactory" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtTCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">ivtT</parameter> </parameter> <!--parameter name="SQProxyCF" locked="false"> <parameter name="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url">file:/D:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">ivtQ</parameter> </parameter--> <parameter name="default" locked="false"> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/D/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">bogusq</parameter> </parameter> </transportReceiver>
Start the axis2 server with the following command:
axis2Server.bat
Send the request from the JMS client, and the sample Axis2 server console will print a message.
For implementation details of other JMS use cases, see JMS Usecases.