cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk Delete Process Instances

brewmaster
Champ in-the-making
Champ in-the-making
Hello,

I discovered that due to a bug in one of my Java service tasks, my business process was never being completed. There are several thousand processes instances that are still listed as running, that should really be completed. This is causing all sorts of issues with memory.

I'm wondering if there is a way to complete these process instances in bulk? Could I maybe update the database tables directly to stop these from running?

Thanks!

Sean
1 REPLY 1

gdharley
Elite Collaborator
Elite Collaborator

While it is possible to do this directly in the database, I believe the best options would be to write a simple unit test that connected to the production database and :

1. retrieved all the bad tasks (using runtimeService.createProcessInstanceQuery().....
2. iterate over the returned list and terminate the instances (runtimeService.deleteProcessInstance(instanceId, reason)

Another alternative would be a similar approach using a script and curl against the REST API.

Let me know if you need some sample code.

Greg