JBoss Community

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

created by Ashish Sinha in jBPM - View the full discussion

Hi,

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.

 

Regards

Ash

Reply to this message by going to Community

Start a new discussion in jBPM at Community