The WSO2 JMS transport can be configured with IBM® WebSphere® MQ. The following topics cover the configuration steps.
...
Code Block |
---|
runmqsc ESBQManager |
Code Block |
---|
ALTER QMGR CHLAUTH(DISABLED) |
Code Block |
---|
REFRESH SECURITY TYPE(CONNAUTH) |
The following will be displayed in the command prompt.
Configuring
...
the ESB JMS transport
...
Add the following transport receiver to the <EI_HOME>/conf/axis2/axis2.xml
file.
...
language | xml |
---|
...
Info |
---|
|
...
|
...
|
...
|
...
|
Add the following transport receiver to the
<EI_HOME>/conf/axis2/axis2.xml
file.Code Block language xml <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> <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:/G:/jndidirectory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MyQueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.UserName" locked="false">nandika</parameter> <parameter name="transport.jms.Password" locked="false">password</parameter> </parameter> <parameter name="myQueueConnectionFactory1" 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:/G:/jndidirectory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MyQueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.UserName" locked="false">nandika</parameter> <parameter name="transport.jms.Password" locked="false">password</parameter> </parameter> </transportReceiver>
Add the following transport sender to the
<EI_HOME>/conf/axis2/axis2.xml
file.Code Block language xml <transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"> <parameter name="default" locked="false"> <parameter name="vender.class.loader.enabled">false</parameter> <parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter> <parameter name="java.naming.provider.url" locked="false">file:/G:/jndidirectory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MyQueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.UserName" locked="false">nandika</parameter> <parameter name="transport.jms.Password" locked="false">password</parameter> </parameter> <parameter name="myQueueConnectionFactory1" 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:/G:/jndidirectory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MyQueueConnectionFactory</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.UserName" locked="false">nandika</parameter> <parameter name="transport.jms.Password" locked="false">password</parameter> </parameter> </transportSender>
Info title Note If you use the default configuration of the IBM MQ queue manager, you need to provide username and password client authentication. The username and password that you need to provide here is the username and password that you provide to log on to your operating system.
Info The
vender.class.loader.enabled
parameter in the above configuration should be added only when you use IBM Websphere MQ as the JMS broker.WSO2 uses some external class loader mechanisms for some external products such as QPID and AMQP due to the limitation of serializing the JMSObject message. However, it is not required to use this mechanism for IBM Websphere MQ. By adding the
This property can also be included in a proxy service, REST API, message store, JMS receiver or the Synapse configuration depending on the use case.vender.class.loader.enabled
parameter, you can skip the external class loader for IBM Websphere MQ.
Copying IBM Websphere MQ libraries
...
In
<EI_HOME>\conf\axis2\axis2.xml
, comment out both the myTopicConnectionFactory parameter and the SQProxyCF parameter. It should look as shown below.Code Block language html/xml <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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</parameter> </parameter> </transportReceiver>
Start the WSO2 EI with the Sample 251 configuration using the following command.
wso2ei-samples.bat -sn 251
- Log into the WSO2 EI management console at: https://localhost:8243/carbon/.
- Select Service Bus -> Source view and update the JMS URL as follows.
jms:/JMS_QUEUE?transport.jms.ConnectionFactoryJNDIName=MQ_JMS_MANAGER&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/C:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue &transport.jms.Destination=JMS_QUEUE
Configure the proxy service as follows.
Code Block language html/xml <definitions xmlns="http://ws.apache.org/ns/synapse"> <proxy name="StockQuoteProxy" transports="https http jms" startOnLoad="true" trace="disable"> <target> <endpoint> <address uri="jms:/JMS_QUEUE?transport.jms.ConnectionFactoryJNDIName=MQ_JMS_MANAGER&java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory&java.naming.provider.url=file:/C:/JNDI-Directory&transport.jms.DestinationType=queue&transport.jms.ConnectionFactoryType=queue&transport.jms.Destination=JMS_QUEUE"/> </endpoint> <inSequence> <property name="TRANSPORT_HEADERS" scope="axis2" action="remove"/> <property name="OUT_ONLY" value="true"/> </inSequence> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:samples/service-bus/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 uncommentSQProxyCF
in the<EI_HOME>\samples\axis2Server\repository\conf\axis2.xml
file as follows.Code Block language html/xml <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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</parameter> </parameter> </transportReceiver>
Start the axis2 Server with the following command.
axis2Server.bat
Add the following parameters to
service.xml
in<EI_HOME>\samples\axis2Server\repository\services\SimpleStockQuoteService.aar.
Code Block <parameter name="transport.jms.ConnectionFactory">SQProxyCF</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</parameter>
Send the request from the JMS client, and the sample Axis2 server console will print a message as follows.
Code Block language none ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy -Dmode=placeorder -Dsymbol=MSFT
Topic Scenario 1: Client to Topic to WSO2 EI Anchor TopicScenario1 TopicScenario1
TopicScenario1 | |
TopicScenario1 |
In this scenario, the JMS client places an order on the topic ivtT. The WSO2 EI listens to this topic, gets the message, and sends it to the back-end server to process the request.
In
<EI_HOME>\conf\axis2\axis2.xml
, uncomment themyTopicConnectionFactory
parameter and comment out theSQProxyCF
parameter. It should look as shown below.Code Block language xml <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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</parameter> </parameter> </transportReceiver>
Start WSO2 EI with the Sample 250 configuration by running the following command.
wso2ei-samples.bat -sn 250
Log in to the server management console at: https://localhost:8243/carbon/.
Click 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
<EI_HOME>/samples/axis2Client
directory and build it using theant
command.Go to the
<EI_HOME>/samples/axis2Client
/src/samples/userguide
directory, open theGenericJMSClient.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:/C:/JNDI-Directory
" (line 82)Set the java.naming.factory.initial to
com.sun.jndi.fscontext.RefFSContextFactory
(line 85)Set the lookup key to
MQ_JMS_MANAGER
(line 89)
Configure the proxy configuration so that it appears as follows.
Code Block language html/xml <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:samples/service-bus/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
<EI_HOME>\samples\axis2Server\repository\conf\axis2.xml
file so that it looks as follows.Code Block language html/xml <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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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:/C:/JNDI-Directory</parameter> <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">MQ_JMS_MANAGER</parameter> <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter> <parameter name="transport.jms.Destination">JMS_QUEUE</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">MQ_JMS_MANAGER</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.
...