How to Stop running process instances and clear history?

Hi All,

I’m deploying a small flow which consist of 5 sec timeEvent and print statement. I am able to deploy this flow successfully however when I try to find the active Process Instances I get null result every time.

runtimeService.createProcessInstanceQuery().active().list();

I want to achieve following result :

  1. Stop the current deployment.
  2. Delete all the history related to it.

Can you guys guide so i can solve this issue ?

Thanks,
Pratik

@Pratik_Nandoskar If your process doesn’t have wait states, then the above query doesn’t return any results , because the process itself would have been completed the execution flow end to end. Try adding some wait states (eg. user task, receive task, etc) to the process and run the query.

From the docs: Suspension | docs.camunda.org

If you suspend the process definition, you prevent the process definition from being instantiated. No further operations can be done while the process definition is in the suspended state.

If you suspend the process instance, you can prevent the process instance from being executed any further. This includes suspending all tasks included in the process instance.

suspending a job definition, you can prevent this job definition from being processed in all process instances of the selected process definition.

https://docs.camunda.org/manual/7.15/user-guide/process-engine/history/#history-cleanup

1 Like