-
1. Re: Recover async activities after jBPM4 restart
mwohlf Jul 26, 2010 4:02 AM (in response to nechukin)Hi Georgy,
my understanding is that async executions are picked up by the job executor, so the following might work and "restart" the excution for an async execution which was "lost".
ManagementService managementService = processEngine.getManagementService();
Job job = managementService.createJobQuery().processInstanceId(id).uniqueResult();
managementService.executeJob(job.getId());
...it's just a guess
-
2. Re: Recover async activities after jBPM4 restart
nechukin Jul 26, 2010 4:48 AM (in response to mwohlf)Yes, this is exactly what I've tried, and it works, but it raises the next question: how to get the list of all process instance IDs?
I guess I can get them directly from DB, but I don't think that it's the correct way to do this...
-
3. Re: Recover async activities after jBPM4 restart
mwohlf Jul 26, 2010 5:30 AM (in response to nechukin)hmm... what about something like this:
ManagementService managementService = processEngine.getManagementService();
List<ProcessInstance> list = processEngine.getExecutionService().createProcessInstanceQuery().list();for (ProcessInstance processInstance : list) {
Job job = managementService.createJobQuery().processInstanceId(processInstance.getId()).uniqueResult();managementService.executeJob(job.getId());
}
but what I don't understand is this:
shouldn't the job executor pick up this anyways in its next cycle, why do we need to do this manually?
-
4. Re: Recover async activities after jBPM4 restart
nechukin Jul 26, 2010 5:50 AM (in response to mwohlf)Thanks a lot Michael, I will try this. Seems to be ok.
Regarding the question about job executor. On my understending it should... but it doesn't.
-
5. Re: Recover async activities after jBPM4 restart
mwohlf Jul 26, 2010 6:42 AM (in response to nechukin)just an idea: maybe the reason why they are not picked up is because they ran out of retries?
the "findFirstAcquirableJob" query the jobExecutor uses on startup has a where clause: "... and job.retries > 0 ..."
guess this makes sense since it would probably pick up tons of old jobs?
-
6. Re: Recover async activities after jBPM4 restart
nechukin Jul 26, 2010 2:38 PM (in response to nechukin)Solution found. The reason why jobs were not recovered automatically is the too long lock timeout in job executor settings:
<process-engine-context> <job-executor threads="4" idle="1000" idle-max="120000" lock="3600000"/> </process-engine-context>
I changed the lock to 10000 (10 seconds) and now it's recovering normally.