Tuesday, June 16, 2009

SOA Suite's MQ adapter

In order to create an mq adapter from SOA suite and connect to mqseries queue.You may need to do the following.

Copy the file com.ibm.mq.jar to $ORACLE_HOME/bpel/lib

(You can download the same from IBM site or if you have MQ software it can found in following directory com.ibm.mq.jar - located in the $MQ_HOME/Java/lib)


GO to server.xml

and make an entry for shared library

shared-library name="oracle.mqseries" version="10.1.3">
code-source path="ORACLE_HOME/bpel/lib/com.ibm.mq.jar"/>
/shared-library>


Go to following location

SOA_HOME/j2ee/container name/application-deployment/default/MQSeriesAdapter/oc4j-ra.xml

YOUr oc4j-ra.xml will be having following entry

imported-shared-libraries>
import-shared-library name="oracle.bpel.common"/>
import-shared-library name="oracle.xml"/>
/imported-shared-libraries>

YOu may need to add the following library file in order to have the ma adapter working



So now it should look like

imported-shared-libraries>
import-shared-library name="oracle.bpel.common"/>
import-shared-library name="oracle.xml"/>
import-shared-library name="oracle.mqseries"/>
/imported-shared-libraries>


Now if you will check your oc4j-ra.xml you will find following entries in that

connector-factory location="eis/MQ/MQSeriesAdapter" connector-name="MQSeriesAdapter">
config-property name="connectionFactoryLocation" value=""/>
config-property name="hostName" value="myhost"/>
config-property name="portNumber" value="1414"/>
config-property name="queueManagerName" value="Queuemanager"/>
config-property name="channelName" value="myChannel"/>
config-property name="userID" value=""/>
config-property name="password" value=""/>
config-property name="clientEncoding" value=""/>
config-property name="hostOSType" value=""/>
config-property name="xATransaction" value="true"/>
connection-pooling use="private">
property name="waitTimeout" value="300" />
property name="scheme" value="fixed_wait" />
property name="maxConnections" value="50" />
property name="minConnections" value="0" />
/connection-pooling>
security-config use="none">
/security-config>
/connector-factory>


So this is it you need to make changes in these files and you are good to go.

config-property name="hostName" value="myhost"/>

here in place of myhost you have to specify the name of the system in which mqseries is running.

config-property name="queueManagerName" value="Queuemanager"/>

Queuemanager should be replaced with the name of your queue manager name.

the port number by default is 1414 only

config-property name="channelName" value="myChannel"/>

you have to define your channel name in the myChannel field.

If you don't have a channel you can use the default value as

config-property name="channelName" value="SYSTEM.DEF.SVRCONN"/>

Once these changes are done you may comment out the other connections

After that you need to restart your server in order to make these changes.

now you can create a simple bpel process to enqueue/dequeue message in queues in MQ

provide you have a running queue manager and queue available.


While creating adapter connection through adapter configuration wizard you need to provide the same connection factory as you have specified in oc4j-ra.xml and the name of the queue as in MQSeries.

Deploy the process and invoke it .you can find the message enqueued in Mq queue.

No comments: