3 Replies Latest reply on Mar 6, 2008 10:05 AM by beve

    Retry at JMS level

    lucdew

      Hi after reading this post: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=131206

      I was expecting to handle automatic retry of processing of a message by doing the following:

      - Use a jms-jca-provider with transacted mode set to true.
      - Throw a RuntimeException from within my action.
      - Let the JMS queue redeliver the message.

      Actually, i was wrong. After reading the code i found that RuntimeException thrown from within my action are always wrapped in ActionProcessingException (see ActionProcessorMethodInfo ). I think that the following code in ActionProcessingPipeline:

      try
       {
       LOGGER.debug("executing processor " + count+ " "+processor+" "+message.getHeader());
      
       currentMessage = processor.process(currentMessage);
      
       if (currentMessage == null)
       {
       break;
       }
       }
       catch (final Exception ex)
       {
      ....
      
      final boolean throwRuntime = transactional && (ex instanceof RuntimeException) ;
      
      


      only deals with RuntimeException due to internal failures in message processing.

      If you have an idea on handling retry at JMS level let me know.


        • 1. Re: Retry at JMS level
          beve

          Hi,

          we've added a quickstart named jms_transacted that might help here. This can be found in the main trunk.

          Regards,

          Daniel

          • 2. Re: Retry at JMS level
            lucdew

            Thanks but it didn't work with JBoss ESB 4.2.1 GA. I had a DTD validation error at deployment because the jms-message-filter does not have any "transacted" attribute (I left the transacted attribute to true on jms-jca-provider element to make it work).


            Also after reading the sources I don't understand how it could work especially since in class ActionProcessorMethodInfo any exception thrown by my action's process method is wrapped into an ActionProcessingException.

            And in ActionProcessingPipeline only instance of RuntimeException are checked (which ActionProcessingException is not but the cause is).

            Is it a new feature ? I had a look at the code in the trunk and haven't found any difference on that.

             try
             {
             final Object response = processMethod.invoke(instance, currentMessage) ;
             if (response instanceof Message)
             {
             currentMessage = (Message)response ;
             }
             else if (response == null)
             {
             return null ;
             }
             else
             {
             throw new ActionProcessingException("Unexpected response type from processor: " + response) ;
             }
             }
             catch (final IllegalAccessException iae)
             {
             throw new ActionProcessingException("Illegal access from processor", iae) ;
             }
             catch (final InvocationTargetException ite)
             {
             final Throwable th = ite.getTargetException() ;
             if (th instanceof ActionProcessingException)
             {
             throw (ActionProcessingException)th ;
             }
             throw new ActionProcessingException("Unexpected invocation target exception from processor", th) ;
             }
            
            


            • 3. Re: Retry at JMS level
              beve

              Hi,

              no the quickstart will not work with 4.2.1 GA, only with the ESB server built from the main trunk (http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk).

              Regards,

              Daniel