I have deployed the JCA Resource Adaptor for Websphere MQ on JBoss and able to pull
messages of a queue. However currently the MQ hostname is configured either via
annotations as shown below. Since I also specify these setting in the wmq.jmsra-ds.xml
file (see below) I was hoping to proxy the MQQueue and access it as an standard jms
destination. This would allow me to keep my code and descriptors separate from the MQ
configuration (Queue Manager, Hostname, Port etc). However trying this I got
anonymous wrote :
| java.lang.ClassCastException: com.ibm.mq.jms.MQQueue cannot be cast to
org.jboss.jms.destination.JBossDestination
| at
org.jboss.jms.client.container.SessionAspect.handleCreateConnectionConsumer(SessionAspect.java:737)
| at
org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect1.invoke(SessionAspect1.java)
After adding the reference to the resource adaptor used (wmq.jmsra.rar) back in, this
problem disappeared, but it ask for the MQ configuration again. Ideally I would like to
configure the MQ Queue / ConnectionFactory in the application server and access it from my
application as a standard JMS destination. This would allow me to keep my code portable.
If you have any suggestion on how this can be achieved, please let me know.
Thanks in advance
Alex
| @MessageDriven(name = "MQRequestListener", activationConfig = {
| @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),
| @ActivationConfigProperty(propertyName = "maxSession", propertyValue =
"10"),
| @ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "Non-Durable"),
| @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
| @ActivationConfigProperty(propertyName = "destination", propertyValue =
"queue/thunderhead/MQRequests")
| @ActivationConfigProperty(propertyName = "channel", propertyValue =
"SYSTEM.DEF.SVRCONN"),
| @ActivationConfigProperty(propertyName = "hostName", propertyValue =
"zeta"),
| @ActivationConfigProperty(propertyName = "port", propertyValue =
"5001"),
| })
| @org.jboss.annotation.ejb.ResourceAdapter(value="wmq.jmsra.rar")
|
or in the deployment descriptor :
| ...
| <activation-config-property>
|
<activation-config-property-name>destinationType</activation-config-property-name>
|
<activation-config-property-value>javax.jms.Queue</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>destination</activation-config-property-name>
|
<activation-config-property-value>WASQueue1</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>channel</activation-config-property-name>
|
<activation-config-property-value>SYSTEM.DEF.SVRCONN</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>hostName</activation-config-property-name>
|
<activation-config-property-value>zeta</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>port</activation-config-property-name>
|
<activation-config-property-value>5001</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>queueManager</activation-config-property-name>
|
<activation-config-property-value>QM_Thunderhead</activation-config-property-value>
| </activation-config-property>
| <activation-config-property>
|
<activation-config-property-name>transportType</activation-config-property-name>
|
<activation-config-property-value>CLIENT</activation-config-property-value>
| </activation-config-property>
| ...
|
WebSphere MQ adaptor configuration
| <?xml version="1.0" encoding="UTF-8"?>
|
| <connection-factories>
|
| <!-- mbeans defining JCA administered objects -->
| <mbean code="org.jboss.resource.deployment.AdminObject"
name="jboss.jca:service=WASDestination,name=MQRequests">
|
| <!-- Bind this AdminObject with the JNDI name IVTQueue -->
| <attribute
name="JNDIName">queue/thunderhead/MQRequests</attribute>
|
| <!-- this MBean depends on the WebSphere MQ resource adapter -->
| <depends
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
|
| <!-- this admin object is a javax.jms.Queue -->
| <attribute name="Type">javax.jms.Queue</attribute>
|
| <!--
| Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages
sent
| to this queue will have their expiry time overridden so that messages never
expire
| -->
| <attribute name="Properties">
| baseQueueManagerName=QM_Thunderhead
| baseQueueName=WASQueue1
| </attribute>
| </mbean>
|
| <!-- JCA Connection factory definitions -->
| <tx-connection-factory>
|
| <!-- Bind this ConnectionFactory with the JNDI name IVTCF -->
| <jndi-name>MQConnectionFactory</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.SVRCONN</config-property>
| <config-property name="hostName"
type="java.lang.String">zeta</config-property>
| <config-property name="port"
type="java.lang.String">5001</config-property>
| <config-property name="queueManager"
type="java.lang.String">QM_Thunderhead</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>
| </tx-connection-factory>
| </connection-factories>
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173910#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...