3 Replies Latest reply on Jul 12, 2010 5:37 PM by Zemian Deng

    jboss 5.1.0 GA JmsXA vs XAConnectionFactory

    testrot Newbie

      Hello,

       

      although I read a lot of documentation and wiki pages, I still don't know when to use which ConnectionFactory. So here is my guess and I would be very grateful if somebody can confirm that this guess is right.

       

      1) The connection factories definied in deploy\messaging\jms-ds.xml (default config only defines JmsXA) should be used for message producers inside EJBs (Session Beans, MDBs). If you use JmsXA, JMS operations are part of the transaction started by the Session Bean and the connections are pooled.

       

      2) MDBs as message consumers automatically use JmsXA. (Where is the corresponding configuration or is it hard coded?)

       

      3) The connection factories definied in deploy\messaging\connection-factories-services.xml (default config defines ConnectionFactory, XAConnectionFactory, ClusteredConnectionFactoroy and ClusteredXAConnectionFactory) should be used by external clients only.

       

      If my guesses are right I still got two questions:

       

      Q1) What is the meaning of the following 3 attributes in the JMSProviderLoader configuration (cf. jms-ds.xml)

      <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
      <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
      <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>

       

      obviously these attributes refer to the XAConnectionFactory defined in connection-factories-services.xml but for what reason? Are there situations in which the should point to ClusteredXAConnetionFactory?

       

      Q2) Is the following comment obsolet (cf. jms-ds.xml)

      <!--
             The JMS provider loader. Currently pointing to a non-clustered ConnectionFactory. Need to
             be replaced with a clustered non-load-balanced ConnectionFactory when it becomes available.
             See http://jira.jboss.org/jira/browse/JBMESSAGING-843.
         -->
         <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
                name="jboss.messaging:service=JMSProviderLoader,name=JMSProvider">
            <attribute name="ProviderName">DefaultJMSProvider</attribute>

      [...]

       

      Perhaps this question is already answered by the answer of Q1, but if the configuration in jms-ds.xml is only used by message consumers and producers inside the application server a failover in case of a cluster node failure would be nonsense because the client (the EJB) and the ConnectionFactory are running on the same cluster node and both fail at the same time.

       

      Thanks for any help.

        • 2. Re: jboss 5.1.0 GA JmsXA vs XAConnectionFactory
          Zemian Deng Apprentice

          Hi testrot, I am not an JBossMessing expert, but I just read up on these  questions, and perhaps this would help you.

           

           

          1) The connection factories definied in deploy\messaging\jms-ds.xml  (default config only defines JmsXA) should be used for message  producers inside EJBs (Session Beans, MDBs). If you use JmsXA,  JMS operations are part of the transaction started by the Session Bean  and the connections are pooled.

          Yes. Use JmsXA for sending msg as part of the CMT tx.

           

           

          2) MDBs as message consumers automatically use JmsXA.  (Where is the corresponding configuration or is it hard coded?)

          No. Consumers uses the XAConnectionFactory, which used and configured by JCA msg inflow (see deploy/jms-ra.rar). For EJB3 MDB, JCA is configurable by javax.ejb.ActivactionConfigProperty annotation.

           

          3) The connection factories definied in  deploy\messaging\connection-factories-services.xml (default config  defines ConnectionFactory, XAConnectionFactory,  ClusteredConnectionFactoroy and ClusteredXAConnectionFactory) should be  used by external clients only.

          Yes, they are for client use throught JNDI lookup; except XAConnectionFactory, which is used by the JCA inflow.

           

           

          Q1) What is the meaning of the following 3 attributes in the  JMSProviderLoader configuration (cf. jms-ds.xml)

          <attribute  name="FactoryRef">java:/XAConnectionFactory</attribute>
          <attribute  name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
          <attribute  name="TopicFactoryRef">java:/XAConnectionFactory</attribute>

           

          As explained, they are used by JCA inflow. JBossMessaging implementation of ConnectionFactory satisfy all three factories, therefore it point to same reference.

           

           

          Q2) Is the following comment obsolet (cf. jms-ds.xml)

          From the ticket status and it seems it is, as solved by adding the new property setters.

           

          Hope these helps.

          • 3. Re: jboss 5.1.0 GA JmsXA vs XAConnectionFactory
            Zemian Deng Apprentice

            BTW, I think you will get much accurate answers by posting to the right forums (to JBossMessaging) for these questions.