5 Replies Latest reply on Feb 5, 2010 5:59 AM by Andrzej Urban

    handling exceptions in AssignmentHandler

    Andrzej Urban Newbie

      Hi,

       

      1. I'm searching for some good practice tips on handling exceptions in AssignmentHandler.

       

      When assigning task to an actor using a custom AssignmentHandler (that implements AssignmentHandler interface) exception occures in assign method.

       

      How should I handle that exception in case of a first task in a process (the process has already started and it has a task with no actors to assign to)

      My first solution is to delete the whole process and inform an user that a process hasn't started. But maybe there's a better solution to this problem.

       

      And what in case this happens not in a first task of a process? I cannot delete a process. (I hope that in case of exception token stays on a previous node but haven't checked it yet)

       

      2. Does JBPM support going back to a previous node (i.e. when exception occures in node-enter event action)? Or maybe there's a better practice?

        • 1. Re: handling exceptions in AssignmentHandler
          john britto Newbie

          JBPM does not move to previous node.But  you can move to tranasction to previous state.by passing signal to previous state.

          OR  by  using Nodes  you can move it.

          • 2. Re: handling exceptions in AssignmentHandler
            Ronald van Kuijk Master
            How should I handle that exception in case of a first task in a process (the process has already started and it has a task with no actors to assign to)

            My first solution is to delete the whole process and inform an user that a process hasn't started. But maybe there's a better solution to this problem.

            The process is only fully started when a first wait-state is encountered or if there is an async=true on the start state. In the first cases there is nothing to delete, the rollback of the transaction will take of this. In the latter, a rollback will have the jobscheduler try to do it again after some time, maybe the assignment works then.

             

            And what in case this happens not in a first task of a process? I cannot delete a process. (I hope that in case of exception token stays on a previous node but haven't checked it yet)

            It does

            Does JBPM support going back to a previous node (i.e. when exception occures in node-enter event action)? Or maybe there's a better practice?

             

            It does this automagically since the transaction is rolled back. But keep in mind that it rolls back to a previous stable state (might be more nodes back than one), depending on how you use async

            • 3. Re: handling exceptions in AssignmentHandler
              Torsten R Newbie
              Hi,


              in my current project we have some quite complex assignment handlers. In case an assignment does not work out (because of a broken configuration) we assign the task to an special user "error". [be sure your identity-session is able to handle the userid]. All tasks assigned to this user are accessible to the support team.

              In addition we save the exception in a variable so that we do not need to crawl through the logs. Our support can check the configuration, reassign the task and solve the lock.


              hth

              Torsten
              • 4. Re: handling exceptions in AssignmentHandler
                Ronald van Kuijk Master

                Runtime assignments in production failing due to a wrong configuration? Shouldn't this be found in test?

                 

                But it is an option to do it like this.

                • 5. Re: handling exceptions in AssignmentHandler
                  Andrzej Urban Newbie

                  Thanks for Your reply.

                   

                  Due to upcoming deadlines I've implemented that solution with a special user as a makeshift solution. Easy to implement and works fine.

                   

                  I'm planning to use a solution with with jobscheduler as we are using some external services to get actors for a task.

                  In this case I think that would automate the job that a special user would have to do manually.