cancel
Showing results for 
Search instead for 
Did you mean: 

Starting a process at some time in the future

lbornov2
Champ in-the-making
Champ in-the-making
We have a use-case where we need call startProcessInstanceByKey in order to obtain the Process instance ID, but we want the process to actually start only 5 minutes *after* startProcessInstanceByKey() was called.

i.e.

/* the actual starting of the process should be delayed by X minutes */
final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("requestType", variables);
System.out.println(processInstance.getId());

Is there any way to do this?
2 REPLIES 2

p4w3l
Champ in-the-making
Champ in-the-making
Service task with some kinda "sleep(3600)" ?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Lev,

One of the solutions could be:

Process design:
NoneStartEvent  —> Timer catching event (Duration 5 mins)  —> Process Body

Code:

final ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("requestType", variables);

Method call starts the process. The process instance creates timer which waits 5 mins. After the timer execution process continues further.

Regards
Martin