0 Replies Latest reply on Jan 30, 2013 5:23 PM by kapdojang

    When exception occur within jms transaction, can I call central exception handling service?

    kapdojang

      When I throw the IllegalStateException as in the quickstarts/jms_transacted, everything seems rollback as expected for this quickstart.

      However, I want to log and send notification, etc. by calling centralized exception handling service whenever any kind of exception thrown.

      So this is what I have tried.

       

      add an action called 'startAction' as first action in the action pipeline, with empty process() method, and in processException() method

      (as I can see example in this link https://community.jboss.org/thread/144693), I have tried to invoke my exception service to take care of log,

      send notification, etc. BTW, I didn't set 'FaultTo' address in message, since I need more info gathered in the message to send,

      not just fault message.

       

      @OnException

      public void processException(Message message, , Throwable t) throws ActionProcessingException {

           try {

                Service logService = new Service("xxx-category", "ExceptionService");

                ServiceInvoker si = new ServiceInvoker(logService);


                si.deliverAsync(message);     // try to deliver message or new error message created in this method

           }

           catch (Exception e) {

                e.printStackTrace();

                throw new ActionProcessingException(e.getMessage(), e);

      }

       

      The problem is when JMS transaction rollback, seems like this service invoker is ignored (not even throw any exception, either) in some reason and

      my centralized exception handler didn't get any message,

       

      Is this right behavior when JMS transaction rollback? Is there any way to invoke my exception handler service?

      I wonder what is standard exception handling strategy for JMS transaction.

       

      Thanks for any comments, ideas

       

      -Kap Jang