Integrating Weblogic with IBM MQ over JMS


We can integrate weblogic with IBM MQ over JMS by creating Foreign JMS server with Links in weblogic server. We need to create .binding file which will acts as file based JNDI provider to create JMS binding to MQ resources.
Will first explain how to create .binding file and then will configure weblogic to use the same.
Steps to create .binding file:
  1. Firstly we need to add below jar’s in CLASSPATH

jms.jar
com.ibm.mq.jar
com.ibm.mqjms.jar
jta.jar
connector.jar
jndi.jar
providerutil.jar
fscontext.jar

  1. Create JMSProperties.config file with below properties

INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/tmp/mqm/jndi
SECURITY_AUTHENTICATION=none

  1. Run below command

./JMSAdmin -v JMSProperties.config
InitCtx>
def qcf(ForeignCF) TRANSPORT(CLIENT) HOST(localhost) PORT(1414) CHANNEL(MQCHANNEL) QMGR(MQMRG)
def q(MQ1) qmgr(MQMRG) queue(MQ1)
def q(MQR1) qmgr(MQMRG) queue(MQR1)
display ctx //to display the connection details
end

  1. The above commands will create .binding file in /tmp/mqm/jndi folder
Now we have .binding file created, will configure weblogic to use the above file.
Below are the steps to configure in weblogic to create Foreign JNDI connection:
  1. Go to JMS Modules

  2. Create a new JMS module name TESTJNDI


  3. Create a new resource Type Foreign Server name TestForeign

  4. Click on TestForeign server. We now need to configure Context Factory and JNDI URL

Set JNDI Intial context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL:             file:/tmp/mqm/jndi
Click save.

  1. Click on Destinations to add the links I.e. configuring local JNDI name to point to foreign MQ queue. Have kept the name same for simplicity.


  2. Click on connection factories. Create the connection factory. The remote JNDI name must match on you have given to MQ connection factory


  3. Activate the session.
Once we have configured above steps, we can create MDB or OSB business service to send message on local JMS queue. Weblogic will use file based JNDI provider i.e. .binding file to post the message on actual MQ server.
Some of the benefits to using JMS as the API to write IBM WebSphere MQ applications. Some advantages derive from JMS being an open standard with multiple implementations. Using an open standard provides the following benefits:1 The protection of investment, both in skills and application code2 The availability of people skilled in JMS application programming3 The ability to plug in different JMS implementations to fit different requirements.
Reference link:

Popular posts from this blog

JAVA embedding in Oracle SOA 12c

Passing/Receiving HTTP header in SOA BPEL