JBoss Community

Re: How to resume a persisted processInstance?

created by Ryan Peterson in jBPM - View the full discussion

A partial answer I've found after playing with timers:

 

The time defined by the timer must pass within the method that invokes or retrieves the session in order to fire the next node. 

 

In other words, a string of nodes with a timer (for instance 15 seconds) all nodes will execute up to the timer and then will return, persisting the ksession.  If a Thread.sleep() for more than 15 seconds happens before calling session.dispose() in the original session.startProcess(), then the timer completes and the next nodes in the process instance will fire.

 

Also the same behavior happens retrieving the session via JPAKnowledgeService.loadStatefulKnowledgeSession, if a Thread.sleep() for a length over the timer value happens, then the timer expires and the next node is called.

 

 

Is there a way to setup a timer, for instance 2 hours, that when the ksession is retrived will check the time between the creation of the timer node, and current time?  Otherwise I don't see how timers would be useful, unless you're willing to dedicate a thread to each processInstance to sit & poll at fixed intervals to check if timers have expired?

Reply to this message by going to Community

Start a new discussion in jBPM at Community