This discussion is archived
1 Reply Latest reply: Nov 23, 2012 10:45 AM by 975942 RSS

set jms LocalTransaction, How can make getTransacted=true

949490 Newbie
Currently Being Moderated
createQueueSession(true, 0)
Its first parameter is set to true,but, Session.getTransacted() is equal to false。

================ java =========================
import javax.jms.Connection;
import javax.jms.Session;

Connection connection = ((QueueConnectionFactory)this.getConnectionFactory()).createQueueConnection();
Session jmsSession = ((QueueConnection) connection).*createQueueSession(*true*, 0);*

jmsSession.getTransacted();                   ============    false

============= wmq.jmsra-ds.xml ===================
<connection-factories>
     <!-- mbeans defining JCA administered objects -->
<mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=ivtqueue">

<!-- Bind this AdminObject with the JNDI name IVTQueue -->
<attribute name="JNDIName">jms/IVTQueue</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
If you need to specify a specific queue manager add the following
baseQueueManagerName=ExampleQM
-->
<attribute name="Properties">
baseQueueName=TEST.QUEUE
</attribute>
     </mbean>
     <!-- JCA Connection factory definitions -->
     <tx-connection-factory>
          <!-- Bind this ConnectionFactory with the JNDI name WSMQJmsXA -->
          <jndi-name>JmsXA</jndi-name>
          <!-- Indicate that the connection factory supports only local transactions -->
          <local-transaction/>
          <track-connection-by-tx/>
          <!-- 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.QueueConnectionFactory</connection-definition>
          <!-- Tell JBoss not to prefix the jndi name of the CF with the java: context and thus allow it to be looked up externally-->
          <use-java-context>true</use-java-context>

          <!--
               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">QM888</config-property> <!-- SYSTEM.DEF.SVRCONN -->
          <config-property name="hostName" type="java.lang.String">192.168.0.165</config-property>
          <config-property name="port" type="java.lang.String">1414</config-property>
          <config-property name="queueManager" type="java.lang.String">QMAA</config-property>
          <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
          <config-property name="CCSID" type="java.lang.String">1208</config-property>
          <max-pool-size>20</max-pool-size>
          
          <!-- define security domain -->
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
     </tx-connection-factory>
</connection-factories>

========================== applicationContext.xml ===================
     <bean id="AAA" class="co.base.JMSQueueConnector">
          <property name="config" ref="JMSDestProperty" />
          <property name="jmsTemplate">
               <bean name="jmsTemplate" class = "co.jms.ManualTransactionJmsTemplate">
                    <property name="connectionFactory" ref="connectQueueFactory" ></property>
               </bean>
          </property>
     </bean>
<jee:jndi-lookup id="connectQueueFactory" jndi-name="java:/JmsXA" resource-ref="false" />

=========================================

How can you make [  jmsSession.getTransacted()  ] equal to true?
Thanks!!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points