Cleanup of running instances

Hi,

If I want to clean a running instance after 100days (after 100 also the instances didn’t get completed then it must get auto cleaned from server and DB) then what is the configuration I need to do. (I am using camunda springboot version 7.17)

Thanks,
Venkaiah.

If the process is still active, then it won’t be cleaned up.

You would need to design all of these “Automatic Closing” processes to support that. For example: (None Start) → (Call Activity: existing Process) → (End)
Then put an Interrupting Timer Boundary on the Call Activity for 100days. The Interrupting Timer would also connect to the (End)

1 Like

Hello @venky1982 ,

adding to @GotnOGuts proposal: A similar effect has a event-subprocess with an interrupting timer start event.

The main advantage of @GotnOGuts proposal is that the process reflects this interruption of the process as this affects the business logic.

Jonathan

@jonathan.lukas and @GotnOGuts thank you for your inputs.

Yes agree, it will impact business logic if we want to delete running instances but due to some other componenet issues our camunda running instances may get stuck in Inprogress so thought to delete unnesisary running instances and those instanes we will progress manually (as part of cleanup process want to delete all those running instances).

If I want to use the sub porcess then I must redesign all the porcesses and must send for retest all test cases whicha re working fine also… :frowning:

Please suggest if there is any cleanup script we can use to delete the running instances apart from using boundary timers (like directly deleting data from DB). I am using the history level as none.

Thanks,
Venkaiah.

Hello @venky1982 ,

please do not use db scripts as there is an api function to delete running instances.

Jonathan

@jonathan.lukas ok sure thank you.

Please provide te service details which we cna use to delete running the instances. Thank you in advance.

Thanks,
Venkaiah.

Hello @venky1982 ,

the runtimeService contains methods to cancel or delete instances.

Jonathan

Thank you @jonathan.lukas

Please let me know if there is any rest service to delete the running instnaces and also will it delete all data from DB for that instance (I am using history level as none).

Thanks,
Venkaiah.

Hello @venky1982 ,

this request will do the same:

https://docs.camunda.org/rest/camunda-bpm-platform/7.19-SNAPSHOT/#tag/Process-Instance/operation/deleteProcessInstance

As thumb rule, the process engine rest api is capable of everything the java api can do as well.

If you are using history level as none, there should be no problem with historical data. The same would apply if you would have configured your history ttl and cleanup.

Jonathan

Thank you so much @jonathan.lukas

Thanks,
Venkaiah.

1 Like