4 Replies Latest reply on Jul 4, 2006 5:27 PM by Ronald van Kuijk

    Help required with exception handling on transitions

    Scott Newbie

      Hi,

      I'm using jBPM 3.1.1 with Hibernate as the persistence layer along with the Spring modules 0.4 release of their JBPM integration module. The problem I'm having is in using an exception handler. I have created a global exception handler for my process which should move the process to an 'Error' end state node (and store the associated error info in a process variable). The exception handler appears to work, but when the exceptions occur due to an error in a transition action, the transition is still followed (even though I specifically set the node to the end state in the exception handler). Is there some flag I need to set on the instance to prevent the default transition being followed?

      I am using the action handler to persist some information added by a user at the end of the task and so I am using the exception handler to ensure if the information is not present or cannot be persisted the process moves to an error state.

      The data is large BLOB data that will be used by other apps so I don't want it persisted by JBPM as a process variable.

      Any help would be greatly appreciated.

      Regards,

      Scott

        • 1. Re: Help required with exception handling on transitions
          Ronald van Kuijk Master

          In short you mean that an errorhandler works when an error happens on an action that was not on a transition.

          Regarding the storage: then store it somewhere else. It's up to you.

          Ronald

          • 2. Re: Help required with exception handling on transitions
            Scott Newbie

             

            In short you mean that an errorhandler works when an error happens on an action that was not on a transition.


            The exception handler always works, in that it always catches the exception and processes it. The problem is that if I set the node in the exception handler, this gets over-written by the transition e.g.

            task.end() <- Exception in the action on the transition happens here and the
            handler sets the node to the 'Error' node, but on completing the signalling of this node, the transition to the default node for this task happens.

            Basically there is no way to tell the signal handler that it should not continue processing when its been dealt with by an exception handler.

            Hope that made sense. ;-)



            • 3. Re: Help required with exception handling on transitions
              Koen Aers Master

              Scott,

              It is generally not a good idea to try to propagate the graph execution from an action in an exception handler. Use the exception handler to set a process variable and then use a decision node after the task node to route the graph execution to the node you want based on the value of this process variable. Or write a customized version of the task node that incorporates this behaviour if you wish.

              Regards,
              Koen

              • 4. Re: Help required with exception handling on transitions
                Ronald van Kuijk Master

                hmmm... normally I would agree, but we have a kind of identical situation as well. The customer thinks he wants to put the process in a certain error state if something happens. If we model this in (from EVERY state) it gets kind of blurry. 50% of all icons in the process are decisions all going to this error state. The customer has the choice to correct something and then put the process back in the state it came from. If you've ever seen a web, it must have been based on this process diagram. So Manipuliating the tokens, just for this kind of error handling seems a good solution for us. Luckily we do not have the problems that errors on actions on transitions (mainly sending a mail or something like that) is not an issue for us.