4 Replies Latest reply on Mar 6, 2015 12:40 PM by nthota

    JMS connection factory transaction mode is xa, however the the MDB transaction type is of NOT_SUPORTED

    nthota

      While I am working on an application I have come across the below MDB code and JMS configuration on JBoss.

      Brief description of flow is that a first MDB posts a message to another MDB. The connection factory used is of type java:JmsXA and

      transaction mode="xa". The destination MDB has transaction annotations as Container managed and transaction attribute as NOT_SUPPORTED.

       

      My question is that the connection factory is configured with xa transaction mode, however the bean is marked as transaction NOT_SUPPORTED.
      Is this a valid configuration?

       

      Connection factory configuration:

        <pooled-connection-factory name="hornetq-ra-for-data-processor">
           <transaction mode="xa"/>
           <min-pool-size>1</min-pool-size>
           <max-pool-size>50</max-pool-size>
           <connectors>
            <connector-ref connector-name="in-vm"/>
           </connectors>
           <entries>
            <entry name="java:/JmsXAForDataProcessor"/>
           </entries>
           <client-failure-check-period>2147483646</client-failure-check-period>
           <connection-ttl>-1</connection-ttl>
           <call-timeout>180000</call-timeout>
           <consumer-window-size>104857600</consumer-window-size>
           <reconnect-attempts>-1</reconnect-attempts>
          </pooled-connection-factory>
      


      First MDB:

         public class PreprocessorMDB implements MessageListener {
              @Resource(mappedName = "java:/JmsXAForDataProcessor")
              ConnectionFactory connectionFactory;
      
           @Resource(mappedName = "java:/queue/queue2")
              Queue dataProcessorQueue;
      

      Second MDB:

       

         @MessageDriven(name = "ProcessorMDB", activationConfig = {
              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
              @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/queue2"),
              @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge")})
          @TransactionManagement(value = TransactionManagementType.CONTAINER)
          @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
          @ResourceAdapter("hornetq-ra-for-data-processor")
          public class ProcessorMDB implements MessageListener {
      
        • 1. Re: JMS connection factory transaction mode is xa, however the the MDB transaction type is of NOT_SUPORTED
          jbertram

          My question is that the connection factory is configured with xa transaction mode, however the bean is marked as transaction NOT_SUPPORTED.

          Is this a valid configuration?

          Yes, it is valid. 

           

          In fact, the two things don't really have anything to do with each other because a producer doesn't send a message to a consumer (e.g. an MDB); a producer sends a message to a destination.  The transaction semantics of a consumer (which consumes a message from a destination) are completely unrelated to the transaction semantics of a producer.

          1 of 1 people found this helpful
          • 2. Re: Re: JMS connection factory transaction mode is xa, however the the MDB transaction type is of NOT_SUPORTED
            nthota

            Thanks Justin for quick reponse and clear explanation.

             

            I have couple of questions here. Please note that the sender MDB is also marked with Transaction type as NOT_SUPPORTED.

            As this connection factory is only used by only these two MDBs, is xa transaction mode required here?.

            Does it have any overhead?

             

            @MessageDriven(name = "PreprocessorMDB", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/queue1"),
                    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
                @TransactionManagement(value = TransactionManagementType.CONTAINER)
                @TransactionAttribute(value = TransactionAttributeType.NOT_SUPPORTED)
                public class PreprocessorMDB implements MessageListener {
                    @Resource(mappedName = "java:/JmsXAForDataProcessor")
                    ConnectionFactory connectionFactory;
                 
                 @Resource(mappedName = "java:/queue/queue2")
                    Queue dataProcessorQueue;
            
            
            • 3. Re: Re: JMS connection factory transaction mode is xa, however the the MDB transaction type is of NOT_SUPORTED
              jbertram

              I have couple of questions here. Please note that the sender MDB is also marked with Transaction type as NOT_SUPPORTED.

              As this connection factory is only used by only these two MDBs, is xa transaction mode required here?.

              If the connection factory is not being used for XA transactions then it's not necessary to explicitly configure it to support XA transactions.

               

              Does it have any overhead?

              No.

              • 4. Re: JMS connection factory transaction mode is xa, however the the MDB transaction type is of NOT_SUPORTED
                nthota

                Thanks Justin, I got the answer