Hi all,
This blog post about creating a remote connection to the IBM MQ which is located in a remote server. To do that, you have to have IBM MQ installed in remote server. For IBM MQ installation you can refer this blog post.
Let's remotely connect to IBM MQ ...
Environment : IBM MQ Version 8.0.0.2 installed in Windows 2012 R2 server
Client is WSO2 ESB 5.0.0 installed in ubuntu 15.10
Steps to connect:
- First, you have to take .bindings file you used (Which is in jndiDirectory)
- Add .bindings file in to a local file directory (Ex: /home/dilshani/Dev/jndiDirectory)
- Edit .bindings file
** Open .bindings file using text editor and replace all places having "localhost" with relevant IP of the server which is installed IBM MQ.
- Add client jars into [ESB_HOME]/repository/components/lib folder
* fscontext
* jms
* providerutil
** You can find these jars inside the java folder in IBM MQ installation file directory (Ex: C:/)
- Remove following line from $ESB_HOME/repository/conf/etc/launch.ini.
- Add WSO2 ESB axis2.xml configs related to JMS transport (You may find axis2.xml file in [ESB_HOME]/repository/conf/axis2/)
Sample Configs:
<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:///home/centos/esb/jndiDirectory</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
<parameter name="transport.jms.Destination" locked="false">testTopic</parameter>
<parameter name="transport.jms.DestinationType" locked="false">topic</parameter>
<parameter name="transport.jms.UserName" locked="false">administrator</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</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:///home/centos/esb/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">administrator</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</parameter>
<parameter name="transport.jms.Destination">LocalQueue1</parameter>
</parameter>
<parameter name="myTopicConnectionFactory1" 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:///home/centos/esb/jndiDirectory</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
<parameter name="transport.jms.DestinationType" locked="false">topic</parameter>
<parameter name="transport.jms.UserName" locked="false">administrator</parameter>
<parameter name="transport.jms.Destination">testTopic</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</parameter>
</parameter>
</transportReceiver>
And also you have to add transport sender configurations too.
<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender">
<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:///home/centos/esb/jndiDirectory</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
<parameter name="transport.jms.Destination" locked="false">testTopic</parameter>
<parameter name="transport.jms.DestinationType" locked="false">topic</parameter>
<parameter name="transport.jms.UserName" locked="false">administrator</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</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:///home/centos/esb/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">administrator</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</parameter>
<parameter name="transport.jms.Destination">LocalQueue1</parameter>
</parameter>
<parameter name="myTopicConnectionFactory1" 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:///home/centos/esb/jndiDirectory</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">myTopicConnectionFactory</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter>
<parameter name="transport.jms.DestinationType" locked="false">topic</parameter>
<parameter name="transport.jms.UserName" locked="false">administrator</parameter>
<parameter name="transport.jms.Destination">testTopic</parameter>
<parameter name="transport.jms.Password" locked="false">wso2321#qa</parameter>
</parameter>
</transportSender>
- Start ESB server and it will create JMS connection.
** Note: If you get any error, please take following steps to solve the issue.
- Ping the server and see whether it can be reach
Ex:
ping <serever ip>
- Telenet the port and see whether it open to connect
telnet <server-ip> <port>
- Restart the IBM MQ
No comments:
Post a Comment