zecas zecas [http://community.jboss.org/people/zecas] created the discussion

"Using JNDI to connect to Websphere MQ, without hardcoded info"

To view the discussion, visit: http://community.jboss.org/message/619269#619269

--------------------------------------------------------------
Hi,

I'm struggling with JBoss to properly use a JNDI connection to completly make a 
connection to Websphere MQ Series, to feed an MDB.

I need some help, I'm trying to "sell" the idea of JBoss for this specific 
client I'm working for, and I would like to pass this difficulty, but I need 
some help from the community.

Versions:
JBoss 5.1.0 GA
Java JDK 1.6.0
WebSphere MQ 7.0.1 (on remote machine, 192.168.1.30:1414)

I've copied the "wmq.jmsra.rar" file into 
c:\...\jboss-5.1.0.GA\server\default\deploy folder. In that same location, I've 
created the file "wmq.jmsra-ds.xml", for the queue settings.

File "wmq.jmsra-ds.xml" contents:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<connection-factories>
    <mbean code="org.jboss.resource.deployment.AdminObject" 
name="jboss.jca:service=WASDestination,name=TestQ">
    <!--<mbean code="org.jboss.resource.deployment.AdminObject" 
name="jca.wmq:name=TestQ">-->
        <depends 
optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
        <attribute name="JNDIName">queue/TestQ</attribute>
        <attribute name="Type">javax.jms.Queue</attribute>
        <attribute name="Properties">
            baseQueueManagerName=QM_server01
            baseQueueName=TestQ
        </attribute>
    </mbean>
    <tx-connection-factory>
        <jndi-name>conn/TestQ</jndi-name>
        <xa-transaction></xa-transaction>
        <rar-name>wmq.jmsra.rar</rar-name>
        
<connection-definition>javax.jms.ConnectionFactory</connection-definition>
        <config-property name="channel" 
type="java.lang.String">SYSTEM.DEF.SVRCONN</config-property>
        <config-property name="hostName" 
type="java.lang.String">192.168.1.30</config-property>
        <config-property name="port" 
type="java.lang.String">1414</config-property>
        <config-property name="queueManager" 
type="java.lang.String">QM_gestaosw_dds02</config-property>
        <config-property name="transportType" 
type="java.lang.String">CLIENT</config-property>
        <!--<max-pool-size>20</max-pool-size>-->
        
<security-domain-and-application>JmsXARealm</security-domain-and-application>
    </tx-connection-factory>
</connection-factories>


In WebSphere MQ server, I have the queue manager instance named "QM_server01" 
and I've created a queue "TestQ" with default values applied. It was a fresh MQ 
install, I've just entered "IBM MQ Explorer" and created the "TestQ" queue.

Now from my project, I have the following Message Driven Bean:

@MessageDriven(
        activationConfig = {
                @ActivationConfigProperty(propertyName="destinationType", 
propertyValue="javax.jms.Queue"),
                @ActivationConfigProperty(propertyName="destination", 
propertyValue="queue/TestQ"),
                @ActivationConfigProperty(propertyName="useJNDI", 
propertyValue="true"),
                @ActivationConfigProperty(propertyName="hostName", 
propertyValue="192.168.1.30"),
                @ActivationConfigProperty(propertyName="port", 
propertyValue="1414"),
                @ActivationConfigProperty(propertyName="queueManager", 
propertyValue="QM_server01")
        })
@ResourceAdapter("wmq.jmsra.rar")
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class TestMQ implements MessageListener {
 
    public void onMessage(Message message) {
        System.out.println(message.toString());
    }
 
}


Now this works fine. If I insert a message in the Websphere MQ, my MDB will 
pick it up with no problem.

My real problem is that, although I have defined the "mbean" in my 
"wmq.jmsra-ds.xml" JBoss deploy file, I cannot find a way to use it to get the 
MQ info.

Looking at my MDB code, I have the IP, PORT, QueManager name all hardcoded. And 
also I have a reference to "@ResourceAdapter" JBoss specific annotation.

I was hoping to configure this info in some server specific file, like the 
"wmq.jmsra-ds.xml", and eventually in the "jboss.xml" or some binding file that 
I could provide in my EJB jar file (which is part of an EAR).

I need to make the project work on JBoss and WebSphere Application Servers, and 
also (and specially) to not relly on remote MQ location hardcoded in my MDB's.

My project will go through several environments until reaching the final 
production environment, and I don't want to make builds for each of them.

So any way of just pointing to the JNDI and JBoss pick it up? Do I need to 
provide a jboss-specific xml binding file in my project?

It this a limitation of JBoss 5.1.0 GA? If so, will JBoss 6 provide the 
solution I'm looking for?


Again, I'm hopping the community to help me solve this situation. As I have it 
now, I will have a hard time moving on with the project in JBoss.


Thanks
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/619269#619269]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to