WebSphere MQ in JBoss AS 7.1
matvei Jan 12, 2012 2:57 AMOk. I would like to migrate from JBOSS 6.0 + WebpshereMQ 7 to JBOSS 7.1 + Webspehere MQ 7.
I've already found how to configure JCA RAR Adatper for Webpshere MQ. But in my old configuration I have had "mbeans" representing single queues, for example. Should I create such JNDI for JMS resources under jboss 7.1? I'll try to post my past configuration and what I've already done under JBOSS 7.1
OLD CONFIG:
file wmq.jmsra-ds.xml
<connection-factories>
<mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.jca:service=WASDestination,name=CUBean">
<!-- Bind this AdminObject with the JNDI name IVTQueue --> |
<attribute name="JNDIName">queues/JB.CU</attribute>
<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=QM01
baseQueueName=JB.CU
</attribute>
</mbean>
<!-- JCA Connection factory definitions -->
<tx-connection-factory>
<!-- Bind this ConnectionFactory with the JNDI name IVTCF -->
<jndi-name>IVTCF</jndi-name>
<!-- Indicate that the connection factory supports XA transactions -->
<xa-transaction />
<!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar -->
<rar-name>wmq.jmsra.rar</rar-name>
<!-- connection-definition is the ConnectionFactory interface
defined in the ra.xml -->
<connection-definition>
javax.jms.ConnectionFactory
</connection-definition>
<!--
Configuration for the ConnectionFactory. This defines the channel, hostname, port,
queueManager, and transportType properties for a client (TCP/IP) connection to WMQ
-->
<config-property name="channel" type="java.lang.String">
SYSTEM.DEF.SVR****
</config-property>
<config-property name="hostName" type="java.lang.String">
someserver.webpshere.mq
</config-property>
<config-property name="port" type="java.lang.String">1234</config-property>
<config-property name="queueManager" type="java.lang.String">
QM01
</config-property>
<config-property name="transportType" type="java.lang.String">
CLIENT
</config-property>
<!-- define security domain -->
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<max-pool-size>1</max-pool-size>
</tx-connection-factory>
</connection-factories>
additional config line in the file
ejb3-interceptors-aop.xml
<!-- IBM WebSphere MQ RCA Message Driven BEANS -->
<domain name="IBMMQMDB" extends="Message Driven Bean" inheritBindings="true">
<annotation expr="!class(@org.jboss.ejb3.annotation.DefaultActivationSpecs)">@org.jboss.ejb3.annotation.DefaultActivationSpecs ({@javax.ejb.ActivationConfigProperty(propertyName="channel", propertyValue="SYSTEM.DEF.SVR****"), @javax.ejb.ActivationConfigProperty(propertyName = "hostName", propertyValue = "someserver.webshere.mq"),@javax.ejb.ActivationConfigProperty(propertyName = "queueManager", propertyValue = "QM01"),@javax.ejb.ActivationConfigProperty(propertyName = "port", propertyValue = "1234"),@javax.ejb.ActivationConfigProperty(propertyName = "maxMessages", propertyValue = "1"),@javax.ejb.ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")})</annotation>
</domain>
Java code for Message Driven Bean:
// fetch connection parameters using EJB3 Interceptors
@AspectDomain("IBMMQMDB") |
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
@MessageDriven( name="CU",
activationConfig = | |
{ | |
@ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"), | |
@ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"), | |
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queues/JB.CU"), | |
@ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "true") | |
}) |
@ResourceAdapter("wmq.jmsra.rar")
public class CU
implements MessageListener { |
{
...
public void onMessage(Message message)
{...}
}
********************** NEW CONFIG FOR JBOSS 7.1 ****************************
file: standalone.xml
<subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">
<resource-adapters>
<resource-adapter>
<archive>
wmq.jmsra.rar
</archive>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/IVTCF" enabled="true" use-java-context="true" pool-name="wmq_jmsra_rar_pool" use-ccm="true">
<config-property name="port">
1234
</config-property>
<config-property name="hostName">
somehost.webpshere.mq
</config-property>
<config-property name="channel">
SYSTEM.DEF.SVR****
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="queueManager">
QM01
</config-property>
<pool>
<min-pool-size>
1
</min-pool-size>
<max-pool-size>
10
</max-pool-size>
<prefill>
false
</prefill>
<use-strict-min>
false
</use-strict-min>
</pool>
<security>
<application/>
</security>
</connection-definition>
</connection-definitions>
</resource-adapter>
</resource-adapters>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ejb3:1.2">
...
<mdb>
<resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
</subsystem>
My Question is: as far I set the Webpshere MQ As default JMS Engine should I define additional JNDI resources for every Queue, how should I use the JBOSS configuration now in Java code?