2 Replies Latest reply on Jul 10, 2009 5:29 AM by Igor Beslic

    Messaging with IBM Websphere MQ 7 JCA Adapter

    Igor Beslic Newbie

      Hi I have followed JBoss and IBM instructions and succeeded to run MQ JCA with JBoss 5.0.1. I use MQ v7. Both JBossAS 5.0.1 and MQ 7 are installed on WinXP. I use AdminObject to publish topic:

       <xa-transaction />
       <config-property name="channel" type="java.lang.String">SYSTEM.DEF.SVRCONN</config-property>
       <config-property name="hostName" type="java.lang.String">localhost</config-property>
       <config-property name="port" type="java.lang.String">1414</config-property>
       <config-property name="queueManager" type="java.lang.String">QM_MYQM</config-property>
       <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
       <config-property name="username" type="java.lang.String">me@MYDOMAIN</config-property>

      admin obj:
      <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=myTopic">
      <!-- Bind this AdminObject with the JNDI name myTopic -->
      <attribute name="JNDIName">myTopic</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.Topic -->
      <attribute name="Type">javax.jms.Topic</attribute>
      <attribute name="Properties">

      This is code in my servlet:
      InitialContext ic = new InitialContext();
      ConnectionFactory cf = (javax.jms.ConnectionFactory) ic.lookup("java:wmq/myFC");
      Topic topic = (Topic) ic.lookup("myTopic");
      Connection conn = cf.createConnection();
      Session sess = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
      MessageProducer mp = sess.createProducer(topic);
      mp.send(sess.createTextMessage("This is topic message at: " + (new Date())));

      1. I have trouble that code executes without any exceptions but I still have no any messages in MQ. Does anybody has maybe expirience with topic publishing?
      2. What if I have 100 topics in my MQ. Is there way to programaticly create topic destination? When I use WS MQ API directly there is way to do that but I would like avoid including WSMQ libraries in my app because then using JCA wouldn't make sense.