1 Reply Latest reply on Jul 12, 2012 12:36 PM by Ashish Sinha

    How to restart process, when process terminated on timer JBPM 5.3

    Ashish Sinha Newbie


      I am trying to restore process from server crash.

      If process hasn't reached to timer event, process is realoaded from old session and continue process calling myWorkItemHandler.completeWorkItem(workItem, manager).


      1. Load Old session - stored in file on server startup


      kSession = JPAKnowledgeService.loadStatefulKnowledgeSession(id, kSession.getKnowledgeBase(),kSession.getSessionConfiguration(), kSession.getEnvironment());

      myWorkItemHandler.completeWorkItem(workItem, manager)



      2. Get the work Item from WorkItem table.

        "SELECT o FROM WorkItemInfo AS o WHERE o.processInstanceId = :processId"


      3. Once recived workItem, from step 2. call

      myWorkItemHandler.completeWorkItem(workItem, manager)


      It works fine if the process was terminated at non timer node.



      But if the process reaches at timer event, there is no way to follow the same approach as info gets deleted from WorkItemInfo table. (It's okie)


      KSession has singalEvent() method, which indicate I can use to complete or restore timer event, but couldn't get success.



      Singal Even : Timer node with ProcessInstanceInfo object

      // Load failed session

      kSession = JPAKnowledgeService.loadStatefulKnowledgeSession(id, kSession.getKnowledgeBase(),

                          kSession.getSessionConfiguration(), kSession.getEnvironment());


      String type = "TimerEvent"; // or "Timer" as per xml represenation of myProcess.bpmn file


      long processInstanceId = 17L;

      Object event = getProcessInstanceInfo(processInstanceId);


      // Signal timer event,

      kSession.signalEvent(type, event, processInstanceId);



      Any idea how to signal this event and what parameter is needed.


      https://issues.jboss.org/browse/jbpm-3170 points to same problem, but no technical information.




        • 1. Re: How to restart process, when process terminated on timer JBPM 5.3
          Ashish Sinha Newbie

          Fixed this issue -


          1. Persist "processInstanceId" once process starts.

          2. Load "process instance id" and send signal.

          // Signal timer event,

          kSession.signalEvent(type, event, processInstanceId);


          Note - No need to load old session - Don't do this



          Check process_instance_info table, if process terminats due to server crash, you would find records there. Sending signal with given process intance id will resume process.


          Job Done!!