We have lot of process instances which are in active state since almost more than year. They are now dormant for us and we need to clean them up(older than 6 months). I was trying see if i can filter process instances by date but couldn’t find any option in the rest apis.
Searching on the forum i found and we can use history/process-instance api but it is returning empty list, maybe because we have history level at none.
Can anyone help me how do I delete running instances which are older than X days.
Another user asked almost the same thing not that long ago in this thread
History probably won’t help you in this, since you are looking for active processes.
You need to run a query to find all active processes, figure out which ones have been running for too long, and then send a request to cancel each one.
The best bet (to me) would be to modify each of your processes to have a wrapper on it that has a “Maximum Run Timer” (interrupting Timer event connected to a Terminate End), and then migrate all your open processes to the new version. That would leave your ended processes in your system to review afterwards.
Short answer: There is no out-of-the-box way to do what you want to do.
with historylevel None, the only date in the database is the creation date of a user task. Database Schema | docs.camunda.org
The process instance saves its dates (start, end, …) only in the history (which doesn’t exist in your case).
Hope this helps, Ingo
Thanks Ingo for your response.
Oh there are processes which do not have user task in them.
I guess then I dont have much options left apart from what @GotnOGuts suggested, but that doesnt seem feasible with almost thousands of such dormant processes. For future yes we can have a wrapper with timer…