4/15/2011

Configure IBM WebSphere MQ 7.0.1.3/ 6.0 (Messaging service) with WSO2 ESB in Windows system

This blog is on some hands on experience of installing IBM Websphere MQ (version 6.0 and 7.0.1.3) the JMS messaging service with WSO2 ESB- the Enterprise Service Bus application

 This includes 2 parts

  1.  IBM MQ installation and configuration
  2.  ESB configuration


Please refer following source for an in-depth explanation of installing in Linux based system:

 1. IBM MQ installation and configuration

1. Install IBM MQ software using following guide


2.  Start ‘IBM WebSphere MQ Explorer, create a new queue manager. Check ‘make this the default queue manager’. Leave rest of the info as it is



3.  Go to newly created Q manager and expand the list, create a new local queue


4. Expand ‘Advanced’ sub tree and add a ‘server-connection’ channel


5. Add a TCP listener from ‘Advanced’ sub tree. LISTENER.TCP is added by default.


6. Go to C:\Program Files\IBM\WebSphere MQ\java\bin, and invoke IVT app
        
    Run : IVTRun.bat –nojndi

If successful you will see the following



7. Run : IVTRun.bat -nojndi -client -m mymgr -host localhost -channel mychannel

If successful you will see the following



8. Go to C:\Program Files\IBM\WebSphere MQ\java\bin, open 'JMSAdmin.config' file and do  following 
             1. INITIAL_CONTEXT_FACTORY- uncomment this line
             ex: INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
             2. PROVIDER_URL - point to an empty folder
             Ex: PROVIDER_URL=file:/D:/JNDI-Directory


9. Run the "IVTSetup.bat" in the command prompt to create the default set of JNDI bindings

If successful you will see the following


10. Now run the IVTRun tool as follows

IVTRun.bat -url "file:/D:/JNDI-Directory" -icf com.sun.jndi.fscontext.RefFSContextFactory

11. By now we have enabled and verified JNDI support. Let's use the JMSAdmin tool to make some modifications in the JNDI bindings

Start jmsadmin.bat in C:\Program Files\IBM\WebSphere MQ\java\bin from the colsole, Run following commands

 ALTER QCF(ivtQCF) TRANSPORT(CLIENT)
 ALTER QCF(ivtQCF) QMGR(mymgr)

Now let’s get to configure the ESB.


ESB configuration

1. Copy the following jar files from C:\Program Files\IBM\WebSphere MQ\java\lib to D:\wso2esb-2.1.0\repository\components\lib

• com.ibm.mqjms.jar
• fscontext.jar
• providerutil.jar
• com.ibm.mq.jmqi.jar
• dhbcore.jar

If you are using IBM MQ 6.0 additionally following jars need to be added
.(you might not find com.ibm.mq.jmqi.jar in MQ 6.0 version)

com.ibm.mq.jar
connector.jar

Optionally you might need the following jars as well.(But in our case they we not required)
jms.jar
jndi.jar
jta.jar
ldap.jar

2. Enable the JMS listener in the axis2.xml. Configure the default and userdefined connection factories as follows

Here the connection factory name is ‘SQProxyCF’ which will be used by the STOCKQUOTEPROXY proxy service in the 250 sample


 If you are using IBM MQ 6.0 , then you might probably add this line as well.



 Here MQ 6.0 uses JMS Spec version 1.0.2b instead of 1.1

3. Note that we have specified a queue named ‘bogusq ‘as the default destination. This is because we need to use ivtQ for our proxy service only. If we use 'ivtQ' here all the services deployed in ESB (XKMS, echo, wso2carbon-sts) will start listening on the same queue.

You also need to login to JMSAdmin and create the queue named ' bogusq'. In JMSAdmin shell run the following commands.
• DEFINE Q(bogusq) QMGR(mymgr)
• ALTER Q(bogusq) QUEUE(localq)

Here ‘localq’ is the one we created earlier

4. Go to SYNAPSE_HOME/samples/axis2Client/src/samples/userguide and open the GenericJMSClient.java source file. 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:/var/mqm/jndi" (line 82)
• Set the java.naming.factory.initial to "com.sun.jndi.fscontext.RefFSContextFactory" (line 85)
• Set the lookup key to "ivtQCF" (line 89)


5. Start sample 250

• wso2esb-samples.bat -sn 250

6. Add following parameter to the synapse config in the proxy service block:






7. Start sample axis2server with SimpleStockQuoteService service

8. Run the following in the client

• ant jmsclient -Djms_type=pox -Djms_payload=IBM

Commands used in this blog for configuring MQ and ESB are taken from following source. All credits to the author of this blog :
http://techfeast-hiranya.blogspot.com/2009/09/enterprise-messaging-with-synapse-wso2.html

4 comments:

  1. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this.
    Are you aware of any other websites on this
    IBM-MQ WEBSPHERE Online training


    ReplyDelete
  2. Thanks Robert. But unfortunately I am no longer associated with neither WSO2 products nor any other middleware applications. Hope you can get more info visiting www.wso2.com or related middleware vendors.
    Regards, Tharinda

    ReplyDelete
  3. I have an issue with installation,
    I created a queue manager the same way as above but i donot get the expansion of queue manager.
    as a result i am unable to add queue.


    Also the connection status shows disconnected. the version i am using is 7.0.1.3
    what to do, HELP!!

    ReplyDelete
    Replies
    1. Sorry. I have no idead since I'm not working with this product at the moment, Post your questions in WSO2 support portal .http://wso2-oxygen-tank.10903.n7.nabble.com/

      Delete