Query on Process Instance Restart

I have the following doubt with respect to process instance restart.

  1. Can a running process instance can be restarted?
  2. If restarted, does the process instance id change?
  3. What happens to the existing variables of the process instance after restarted?
  4. What happens to the active and historic task of the process instance after restarted?

Please advise

Yes

Yes/No depending on what you mean by restart

It will have the last known values of the processes.

It depends on how you do it - but you would kill all running tokens and create a new one at the start event.

1 Like

@Niall, Thanks for your response.

I want to restart a process instance again from the beginning. In this case does process instance id change?

Is there a way we can delete the existing process variables while restarting?

Sure, that isn’t a problem - you would just need to use theprocesses modification feature of the engine to remove the active tokens and create a new ones. Then you can remove the variables and you’re good to go.

Although why is it important to keep the processes instance id?

It does create a new process instance id . Its explained here .

https://docs.camunda.org/manual/7.12/user-guide/process-engine/process-instance-restart/

That’s only if you’re restarting a completed process… if the processes is not yet finished you can “restart” it and keep the same id. Which is why i suggested the modification API instead of the restart instance api.

1 Like

thanks for the clarification . Also is it better to restart through some event ( Like using Conditional Start Event) rather than using an API . That way i can visually see that the process can be initialized and restarted if needed .

If beginning from the start is usual behavior then i’d certainly suggest modeling it, there are lots of possible ways of doing that. If it is not an expect or frequent occurrence then modeling it might be a little over the top.

Make sense. Thanks