Tuesday, March 7, 2017

Communicating with Websphere MQ from TIBCO BW

How to connect Websphere MQ from TIBCO Businessworks-JMS.

  • We can connect MQ via TIBCO JMS without using MQ Adapter.
  • Here TIBCO is acting as a client for the MQ server and the steps are given below to establish a connection between TIBCO JMS and MQ.

Step 1: Add MQ jars location into your system classpath.

                C:\Program Files\IBM\WebSphere MQ\java\lib

Step 2: Copy the below listed jar files into TRA path

                From [MQ jar file path]: C:\Program Files\IBM\WebSphere MQ\java\lib 

                To [TRA path]: C:\tibco\tra\5.9\lib

                Jar files list:
                                com.ibm.mq.jar
                                com.ibm.mq.jmqi.jar
                                com.ibm.mq.soap.jar
                                com.ibm.mqjms.jar
                                fscontext.jar
                                providerutil.jar

Step 3: Edit TIBCO BW configuration files.

a)      C:\tibco\bw\5.11\bin\bwengine.tra
-          In bwengine.tra, include MQ jar path (C:\Program Files\IBM\WebSphere MQ\java\lib) to tibco.env.CUSTOM_EXT_APPEND_CP.
b)      C:\tibco\designer\5.9\bin\designer.tra
-          In designer.tra, include MQ jar path (C:\Program Files\IBM\WebSphere MQ\java\lib;)  to tibco.env.CUSTOM_CP_EXT.

Step 4: Create file based JNDI binding for MQ server.

a)      Create a QueueManaeger in the MQ server
b)      Create a Queue in the MQ server for the QueueManager which you created in previous step. [Ex: testq]
c)       Create a folder in your local system to hold the JNDI binding configurations. This will be used in JNDI lookup.
C:\tibco\JNDI-Directory
d)      Edit JMSAdmin.config file.
File Path: C:\Program Files\IBM\WebSphere MQ\java\bin
-          Set INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
-          Set PROVIDER_URL=file:/C:/tibco/JNDI-Directory

e)      After editing the JMSAdmin.config file, run JMSAdmin.bat file through command prompt.

-          Go to ‘C:\Program Files\IBM\WebSphere MQ\java\bin’ in command prompt and execute the JMSAdmin.bat file.
-          This should start the InitCtx> prompt
-          Run the below command in InitCtx prompt to create a binding configurations in C:\tibco\JNDI-Directory.
Command:

DEFINE QCF(QueueConnectionFactory)+
QMANAGER(QueueMGR) (where QueueMGR is the name of your queue manager)
DEFINE Q(testq)+ (where input is the name of your queue)
QMANAGER(QueueMGR)+
QUEUE(testq)+
TARGCLIENT(MQ)



               
-          After executing the command, the .binding file would have been created in C:\tibco\JNDI-Directory and this will be used by all the jms clients which need to communicate/connect with MQ server.

Step 5: Set below configurations in TIBCO

a)      Configure the JMS connection with below values
-          JNDI Context Factory = com.sun.jndi.fscontext.RefFSContextFactory
-          JNDI Context URL = file:/C:/tibco/JNDI-Directory/
-          Queue Connection Factory = QueueConnectionFactory

b)    Test the JMS connection. It should be successful for QCF. Ignore for TCF.





Step 5: Set below configurations in MQ Explorer.

a)      Right click on the JMS Administered Objects and select Add Initial Context.
b)      Provide the below details in the Add Initial Context Box.



c)    Now, you should be able to see your connection factory under Connection Factories directory.
d)    You can create/view the queues in the destination directory.

Step 6: Test the BW process by sending messages on queue.

a)    Create a BW process to post messages on queue.



b)      Check the queue existence in MQ Explorer.


c)       Run the BW process.


       
d)      Now check the messages count in MQ explorer. Here I have pushed 3 messages on the given queue through BW process and I could see the same message counts in MQ explorer.

  
Step 7: Create a message flow in IIB toolkit to read messages on queue in MQ server.
   
   

e)      Here I created a message flow to read jms messages on queue[testq], write the message  in txt file and send the same message to another queue[testoutq].


Step 8: Create another TIBCO BW process to read the message from the output queue [testoutq] in MQ server and test the processes. I could send and receive jms message to/from MQ server successfully.





No comments:

Post a Comment