Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-19137

If Camel-Jms uses XA ConnectionFactory without TransactionManager, WARN or ERROR message should be logged

XMLWordPrintable

    • Icon: Feature Feature
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • fuse-7.10.2-GA
    • Camel
    • False
    • None
    • False
    • 0
    • 0% 0%
    • Todo

      This request comes from the following use case. Actually, a messages is not removed from queue when using XA connection and no transaction manager.

      <bean class="org.apache.camel.component.jms.JmsComponent" id="jms">
        <property name="connectionFactory">
          <reference filter="(osgi.jndi.service.name=jms/xa/artemis)" interface="javax.jms.ConnectionFactory"/>
        </property>
      </bean>
      
      <from id="_from2" uri="jms:queue:incomingOrders"/>
      

      When XA connection factory is used, DefaultJmsMessageListenerContainer let TransactinManager ack to the Artemis broker. So without setting TM in the JmsComponent, no acknowledgement is sent back to the broker after the message is received by Camel. This causes the message to remain in the queue.

      In general, If any transaction is not used for a camel-jms endpoint and camel route, non-xa connection factory should be used.
      In addition to it, the timing of the acknowledgement is different between non-xa an xa connection.
      Non-XA connection will return ack before routing message through the camel route.
      XA with TM will return ack after routing message through the camel route. User would assme Non_XA connection behavior when User defines non transaction and AUTO-ACKNOWLEDGE endpoint.
      So it would be user friendly to log WARN messages to let user know they should use non-xa connection factory when they uses non-transaction and AUTO_ACKNOWLEDGE endpoint.

      [Instruction to reproduce the issue]
      1: Start Artemis Broker 7.8.6 (Same instruction with fuse-karaf-quickstarts-7.10.0.fuse-7_10_2-00001-redhat-00002/camel/camel-jms)
      2: Start Karaf (Fuse 7.10.2)
      3: On the karaf console do
      feature:install pax-jms-pool-pooledjms pax-jms-config artemis-jms-client pax-jms-artemis camel-blueprint camel-jms
      4: put the /camel-jms/src/main/resources/etc/artemis-pax-jms-xa-factory-pooledjms.xml under ${KARAF_HOME}/deploy directory
      5: do "mvn install" the attached project which is based on fuse-karaf-quickstarts-7.10.0.fuse-7_10_2-00001-redhat-00002/camel/camel-jms
      6: On the karaf console do
      install -s mvn:org.jboss.fuse.quickstarts/camel-jms/7.10.0.fuse-7_10_2-00001-redhat-00002
      7: check karaf console. A message routing is completed.

      karaf@root()> camel:route-list
       Context               Route               Status              Total #       Failed #     Inflight #   Uptime        
       -------               -----               ------              -------       --------     ----------   ------        
       jms-example-context   file-to-jms-route   Started                   1              0              0   3 minutes    
       jms-example-context   jms-cbr-route       Started                   1              0              0   3 minutes    
      karaf@root()>
      

      8: check artemis admin console (http://localhost:8161)
      The message is still in the queue. Also please note that there is no "message acked" from the artemis client.

      ID  Name          Address Consumer Count Message Count Total Messages Added Total Messages Acked
      5650 incomingOrders incomingOrders  1              0                  1                0
      

              Unassigned Unassigned
              rhn-support-hfuruich Hisao Furuichi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: