1 Reply Latest reply on Feb 12, 2012 3:22 PM by visik7

    Transaction on JMS using OpenMQ provider

    visik7

      Hi,

      I'm struggling with the following problem:

      I'm running jboss 4.2.3GA and I use OpenMQ as JMS provider

      this is my jms configuration file:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      
      <connection-factories>
      
       <!-- Modifica per la gestione di openmq -->
        
      <mbean code="org.jboss.naming.ExternalContext" 
             name="jboss.jndi:service=ExternalContext,jndiName=mq">
                   <use-java-context>true</use-java-context>
          <attribute name="JndiName">mq</attribute>
          <attribute name="Properties">
              java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
              java.naming.provider.url=file:///C:/Users/mbazzani/OpenMQ/var/mq/instances/imqbroker/fs370
          </attribute>
          <attribute name="RemoteAccess">true</attribute>
          <attribute name="InitialContext">javax.naming.InitialContext</attribute>
      
      
      </mbean>
      
      
      
      
                 <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                           name="imq.provider:service=JMSProviderLoader,name=JMSProvider">
          <attribute name="ProviderName">DefaultJMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">jnp://127.0.0.1/mq/XAConnectionFactory</attribute>
          <attribute name="QueueFactoryRef">jnp://127.0.0.1/mq/XAQueueConnectionFactory</attribute>
          <attribute name="TopicFactoryRef">jnp://127.0.0.1/mq/NonXATopicConnectionFactory</attribute>
          <attribute name="Properties">
              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              java.naming.provider.url=localhost
              java.naming.factory.url.pkgs=org.jnp.interfaces
          </attribute>
        </mbean>
      
      
      
      
      
      
         <mbean code="org.jboss.naming.NamingAlias"
                            name=":service=NamingAlias,fromName=queue/DLQ">
          <attribute name="ToName">mq/DLQ</attribute>
          <attribute name="FromName">queue/DLQ</attribute>
         </mbean>
      
      
                          <mbean code="org.jboss.naming.NamingAlias"  name=":service=NamingAlias,fromName=jms/ConnectionFactory">
                    <attribute name="ToName">mq/XAConnectionFactory</attribute>
                    <attribute name="FromName">jms/ConnectionFactory</attribute>
                          </mbean>
      
      
      
      
      
      
                <mbean code="org.jboss.naming.NamingAlias" 
             name=":service=NamingAlias,fromName=jms/QueueConnectionFactory">
                    <attribute name="ToName">mq/XAQueueConnectionFactory</attribute>
                    <attribute name="FromName">jms/QueueConnectionFactory</attribute>
                </mbean>
      
      
                <mbean code="org.jboss.naming.NamingAlias" 
                       name=":service=NamingAlias,fromName=jms/TopicConnectionFactory">
                    <attribute name="ToName">mq/XATopicConnectionFactory</attribute>
                    <attribute name="FromName">jms/TopicConnectionFactory</attribute>
                </mbean>
      
      
      
      
      
      
        <!-- ==================================================================== -->
        <!-- JMS Stuff                                                            -->
        <!-- ==================================================================== -->
      
      
      
      
        <!-- The server session pool for Message Driven Beans -->
        <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
                 name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool">
          <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
          <attribute name="PoolName">StdJMSPool</attribute>
          <attribute name="PoolFactoryClass">
            org.jboss.jms.asf.StdServerSessionPoolFactory
          </attribute>
        </mbean>
      
      
        <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
        <tx-connection-factory>
          <jndi-name>JmsXA</jndi-name>
          <xa-transaction/>
                <track-connection-by-tx/>
                <rar-name>jms-ra.rar</rar-name>
          <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
          <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
          <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
          <max-pool-size>20</max-pool-size>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
        </tx-connection-factory>
      
      
      </connection-factories>
      
      

       

       

      The problem is that the transaction is not honored and the Message is sent to the queue before the transaction complete.

      Anyone know if it's a know issue if I missed something or something like that ?

      Attached the Ejb/Ear project used for test

      Obviously the connection factory in openMq are all XA

      and I reviewed all the paths but I cannot figure out where the problem is

      Thanks in advice