Maybe you can use stateless ksession?
Sorry Sergey, but I don't understand, what you mean, can you please elaborate?
Is there some APIs on stateless ksession that would allow to delete a process instance?
ksession = kbase.newStatelessKnowledgeSession();
i think it type of session don't save data to db
ok, I see.
No, it's not an option, we want process instance to be persited to DB.
But we want to delete old process instances...
I just found out, that the completed (or explicitely aborted) process instances do in fact get deleted, that's good!
But still there is a lot of abandoned active instances that just did not run till completion, and they are staying in the DB. What would be the the way to clean them??
Why are there abandoned instances? These should have been completed and the JBPM can remove it.
You could model your process in such a way that these process get completed (have end nodes) in such cases where currently they are abandoned.
My process does have end nodes, and in normal cases the instance ends and gets removed. But sometimes some instance, for whatever reasons, just stays in some human task node forever (unfortunately you cannot force those stupid humans to do their work, you know ). That instance remains then forever in the DB.