1 Reply Latest reply on Apr 19, 2007 1:47 PM by Vt Ysh

    Transition Exception Handling with Tasks

    kaisor sc Newbie

      I am using jbpm 3.1.2.

      suppose there are two tasks.
      Task-A with actor-A
      Task-B with actor-B.
      Transition t from task-A to Task-B.

      i add an actionHandler in this transition t.
      At beginning, actor A has a task and triggers the transition t.

      If there is no exception-handler defined and this actionhandler throws an exception, then actor-B receive no new task and actor-A lost this task.

      so i add an default exception-handler which does nothing indeed. And now if the actionhandler throws exceptions, actor B will receive a new TaskInstance. TaskA of Actor A will be closed.

      but what i really want is in case the actionhandler throws exception, the actor A should still hold the task, and Actor B by no means receives any new tasks.

      How can I achieve this?

        • 1. Re: Transition Exception Handling with Tasks
          Vt Ysh Newbie

          Try to process an exception in your application while you are ending taskInstance. With session transaction mechanism you able to rollback it if ending of task fails. But i don't know how to correctly close JbpmContext after rollback, because default close method begin to throw exceptions after performing of it.

          Transaction transaction=jbpmContext.getSession().getTransaction();
          transaction.begin();
          try
          {
           taskInstance.end();
          }
          }catch(Excepton e)
          {
           transaction.rollback();
          }