Start process with delay

How to add start timer to the process which for instance will start the process after 30 seconds?
I have tried to use TimerStartEvent with duration set to PT30S and Date set to now() + 30 sec. and it does not work. The process starts immediately after calling:

camundaProcessEngine.getRuntimeService()
                .startProcessInstanceByKey(MY_PROCESS,
                        MY_KEY,
                        MY_VAR_INPUT_MAP)

If you deploy a process with a timer start event you don’t need to call the start process method, the engine will take care of starting it automatically after the time has elapsed.

1 Like

I’d use a none start event and immediately after that a timer event. Thus, after you start the process, it would wait the specified amount of time and only then do the real work. If it’s what you want.

1 Like

You mean something like this?
2020-12-22 10_28_58-Camunda Modeler

and after running this:

camundaProcessEngine.getRuntimeService()
                .startProcessInstanceByKey(MY_PROCESS,
                        MY_KEY,
                        MY_VAR_INPUT_MAP)

the Task will start after a minute?

Yes, I meant exactly that. You can even control the delay if you pass the desired delay as an input variable and set the delay property of the timer task to an appropriate expression (${...}).

1 Like