Professional Documents
Culture Documents
Jboss With MQ PDF
Jboss With MQ PDF
Introduction
This document describes the integration with Web Sphere MQ Series from any J2EE 1.4 compliant application server without custom inte-
gration code with the help of JCA 1.5 compliant resource adapter provided by IBM.
Web Sphere MQ implements the industry standard java Message Service (JMS) interface.
Assumptions
This document describes many concepts and prerequisite knowledge of the following is considered essential:
jBoss Application Server setup usually comes as jboss-VERSION. packages which can be easily extracted to any desired location.
Install WebSphere MQ Server 7 using custom option. During the product selection phase we need to make sure Java Extended Transaction
option under Java and Web Services section is also selected to install XA-Transaction support for MQ Server which will be required later.
Upon successful installation of MQ Server we will see icon in our system tray which indicates that MQ Server up and running.
As a first step of our configuration we need to create a Queue Manager. Open a command prompt and navigate to the bin directory which can
be found under WebSphere_MQ_Install_Dir. We can create queue manager by executing following command;
Quick Guide to Jboss with MQ- Release R13.00 -Page 2 of 10 - (c) Temenos Systems 2013 05/07/2013
Once the queue manager is up and running User needs to create some local queue (physical destinations) where messages will get stored. To
create queues issue the following command;
Description: First we have to enter into MQSC shell (where we can manipulate our queue manager settings) then we create our queues. Above
two define statement will create t24OFSQueue and t24OFSReplyQueue destinations into queue manager T24QM. While defining queues if
the queen names are not given inside quotes () then it will be created in Uppercase.
To exit from MQSC shell just type end and hit return.
Finally we need to start a MQ listener for the queue manager to communicate with outside world, MQ listener can be started by executing fol-
lowing command;
Description: Above command will start MQ listener for queue manager (-m) T24QM, on port (-p) 1415 and transport protocol will be used (-
t) TCP.
After creating Queue manager, Queues and starting listener, following components need to be deployed in jboss Application server.
1) wmq.jmsra.rar
2) tocfT24ra-ra.rar
3) tocfOFSmessage-ejb.jar
4) mq-ds.xml
5) t24-ds.xml
6) ibmmq-destinations-service.xml
7) BrowserWeb.War
8) netty-3.2.4.jar
Quick Guide to Jboss with MQ- Release R13.00 -Page 3 of 10 - (c) Temenos Systems 2013 05/07/2013
Step 2: Deploying WebSphere MQ Connection Factory
Jboss application server will use the WMQ connection factory to connect to WebSphere MQ Server so we need to copy following file into
[JbossInstallDirectory]\server\default\deploy]directory;
mq-ds.xml
</connection-factories>
Copy ibmmq-destinations-service.xml file into [JbossInstallDirectory]\server\default\deploy]directory which should look similar to the one
below;
Ibmmq-destinations-service.xml
<server>
<mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.jca:-
service=WASDestination,name=t24OFSQueue">
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
<attribute name="JNDIName">queue/t24OFSQueue</attribute>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=T24QM
baseQueueName=t24OFSQueue
</attribute>
</mbean>
< mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.jca:-
service=WASDestination,name=t24OFSReplyQueue">
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
Quick Guide to Jboss with MQ- Release R13.00 -Page 4 of 10 - (c) Temenos Systems 2013 05/07/2013
<attribute name="JNDIName">queue/t24OFSReplyQueue</attribute>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=T24QM
baseQueueName=t24OFSReplyQueue
</attribute>
</mbean>
</server>
ejb-jar.xml
Quick Guide to Jboss with MQ- Release R13.00 -Page 5 of 10 - (c) Temenos Systems 2013 05/07/2013
<activation-config-property-name>hostName</activation-config-property-name>
<activation-config-property-value>127.0.0.1</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>port</activation-config-property-name>
<activation-config-property-value>1415</activation-config-property-value>
</activation-config-property>
<activation-config-property>
<activation-config-property-name>queueManager</activation-config-property-name>
<activation-config-property-value>T24QM</activation-config-property-value>
</activation-config-property>
</activation-config>
<resource-ref id="ResourceRef_jmsQueueConnectionFactory">
<description>T24 Queue Connection Factory</description>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24ConnectionFactory">
<description>T24 JCA Connection Factory</description>
<res-ref-name>eis/t24ConnectionFactory</res-ref-name>
<res-type>com.temenos.tocf.t24ra.T24ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref id="ResourceRef_t24OFSReplyQueue">
<description>OFS reply queue</description>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</message-driven>
</enterprise-beans>
<container-transaction>
<method>
<ejb-name>OFSMessageMDB</ejb-name>
<method-name>*</method-name>
</method>
<!-- NotSupported|Supports|Required|RequiresNew|Mandatory|Never -->
<trans-attribute>Required</trans-attribute>
</container-transaction>
</ejb-jar>
Jboss.xml
Quick Guide to Jboss with MQ- Release R13.00 -Page 6 of 10 - (c) Temenos Systems 2013 05/07/2013
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
<jboss>
<enterprise-beans>
<message-driven>
<resource-adapter-name>wmq.jmsra.rar</resource-adapter-name>
<ejb-name>OFSMessageMDB</ejb-name>
<configuration-name>Standard Message Inflow Driven Bean</configuration-name>
<destination-jndi-name>queue/t24OFSQueue</destination-jndi-name>
<resource-ref>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<!--<jndi-name>java:/ConnectionFactory</jndi-name>-->
<jndi-name>java:wmq/myFC</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<jndi-name>queue/t24OFSReplyQueue</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>eis/t24ConnectionFactory</res-ref-name>
<jndi-name>java:jca/t24ConnectionFactory</jndi-name>
</resource-ref>
</message-driven>
</enterprise-beans>
</jboss>
Note: Above jboss.xml will map the activation specification defined in ejb-jar.xml to a jBoss Application Server. As we are using WMQ
resource adapter we need to make sure that we use correct JNDI name in jms/jmsConnectionFactory i.e. java:wmq/myFC.
t24-ds.xml:-
<connection-factories>
<tx-connection-factory>
<jndi-name>jca/t24ConnectionFactory</jndi-name>
<rar-name>tocfT24ra-ra.rar</rar-name>
<connection- definition>com.temenos.tocf.t24ra.T24ConnectionFactory</connection- def-
inition>
<config-property name="hosts" type="java.lang.String">127.0.0.1</config-property>
Quick Guide to Jboss with MQ- Release R13.00 -Page 7 of 10 - (c) Temenos Systems 2013 05/07/2013
<config-property name="ports" type="java.lang.String">51164</config-property>
<config-property name="allowInput" type="java.lang.Boolean">true</config-property> <con-
fig-property name="env" type="java.lang.String">OFS_SOURCE=BROWSERTC</config-property>
<config-property name="debugPort" type="java.lang.Integer">9087</config-property>
</tx-connection-factory>
</connection-factories>
Test Configurations
We can verify configurations up to this point by putting messages on our t24OFSQueue and check whether OFSMessageMDB gets activated
and pos t message to T24 and see the response in t24OFSReplyQueue. We need to open a command prompt on system where MQ server is
installed and navigate to bin directory of Websphere_MQ_Install_Dir and apply following command but Ensure that jboss is in running state
and jbase_agent listening to port number 51164.
We can verify the response by this command amqsget.exe t24OFSReplyQueue from WebSphere_MQ_Install_Dir/bin directory.
4) In right side pane select t24OFSReplyQueue and you can see the response in that.
You can also notice output on T24 jbase_agent screen if it is running in debug mode;
For Eg:
Jbase_agent p 51164 L2
Important Note:
Quick Guide to Jboss with MQ- Release R13.00 -Page 8 of 10 - (c) Temenos Systems 2013 05/07/2013
If this test passes we can simply deploy BrowserWeb.war defined in next step. If any exceptions occurred on this stage, we need to rectify the
problem before we move onto next step.
Jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-ref>
<res-ref-name>jca/t24ConnectionFactory</res-ref-name>
<res-type>com.temenos.tocf.t24ra.T24ConnectionFactory</res-type>
<jndi-name>java:jca/t24ConnectionFactory</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>jms/jmsConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<!--<jndi-name>java:/ConnectionFactory</jndi-name>-->
<jndi-name>java:wmq/myFC</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>queue/t24OFSQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<jndi-name>queue/t24OFSQueue</jndi-name>
</resource-ref>
<resource-ref>
<res-ref-name>queue/t24OFSReplyQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<jndi-name>queue/t24OFSReplyQueue</jndi-name>
</resource-ref>
</jboss-web>
After configuring above component Start jboss (by clicking run.bat) and start jbase_ agent listening to port number specified in t24ds.xml
(jbase_agent p 51164) login to T24.
Quick Guide to Jboss with MQ- Release R13.00 -Page 9 of 10 - (c) Temenos Systems 2013 05/07/2013
Resources
Using WebSphere MQ Server with jBoss Application Server 4..
http://www.jboss.org/community/wiki/UsingWebSphereMQSeriesWithJBossASPart4
Quick Guide to Jboss with MQ- Release R13.00 -Page 10 of 10 - (c) Temenos Systems 2013 05/07/2013