1 Reply Latest reply on Oct 2, 2009 8:14 AM by kconner

    jms-listener and transactions (message loss)

    uiterlix

      Can anyone please explain how to create a service with a jms listener that is truly transactional. Which means the message is only removed from the queue when the service pipeline processing succeeds.

      My current configuration is as follows. I created a jms-jca-provider:

       <jms-jca-provider providerAdapterJNDI="java:/RemoteJMSProvider" name="JMS" connection-factory="XAConnectionFactory">
       <jms-bus busid="orderRegelEventWebQueueBus">
       <jms-message-filter dest-type="QUEUE" transacted="true" dest-name="queue/orderRegelEventWebQueue"/>
       </jms-bus>
       <activation-config>
       <!-- The maximum number of times a message is redelivered before it is sent to the DLQ -->
       <property name="dLQMaxResent" value="5"/>
       </activation-config>
       </jms-jca-provider>
      

      and a service with a jms listener referencing this provider:
       <service category="process" description="Web test service" name="WebTestService" invmScope="GLOBAL" invmTransacted="true">
       <listeners>
       <jms-listener name="OrderRegelEventListener" busidref="orderRegelEventWebQueueBus" is-gateway="true"/>
       </listeners>
       <actions mep="OneWay">
      .
      .
      .
      


      The queue being read from is a remote queue on another Jboss application server. Both are jboss-4.2.3.GA with jboss-esb-4.6 and jboss-messsaging 1.4.4.GA.

      When I add a message to the queue, the service starts processing this message. I included an action which deliberately throws a runtime exception. This results in the message processing failing after which the message is being re-read by the jms-listener. This happens infinitely (which makes kind of sense since the processing fails every time). But when I terminate the application server at this stage, and take a look at the amount of messages in the queue, the queue appears to be empty, which means my message is lost. That's definitely not what I want.

      A few questions:
      - Why is the message re-read infinitely when the dlqMaxResent is set to 5 ? (I don't know if it is actually being put back on the queue since I can't see). I would have expected it to move to the DLQ after 5 attempts. Also setting the redelivery parameters on the queue have no effect.
      - How can the message pick-up as wel as the action processing being done in a single transaction? I use an Oracle XA datasource in my actions.
      - Do I need a transactional default-datasource for jbms ?


        • 1. Re: jms-listener and transactions (message loss)
          kconner

           

          "uiterlix" wrote:
          - Why is the message re-read infinitely when the dlqMaxResent is set to 5 ? (I don't know if it is actually being put back on the queue since I can't see). I would have expected it to move to the DLQ after 5 attempts. Also setting the redelivery parameters on the queue have no effect.

          You have moved from the JMS (JCA) gateway transport to the InVM transport and they are separate transports. I do not believe we have an equivalent configuration for the InVM transport but we should have.

          I'll create an issue for this.

          "uiterlix" wrote:
          How can the message pick-up as wel as the action processing being done in a single transaction? I use an Oracle XA datasource in my actions.
          - Do I need a transactional default-datasource for jbms ?

          The InVM pickup should be done within the same transaction as the datasource actions. If you are referring to the JMS gateway then this would be a separate transaction within the current codebase.

          Kev