6 Replies Latest reply on Aug 2, 2013 4:42 AM by obon

    how to delete a process instance

      I googled but somehow failed to find a satisfactory answer to that...

       

      Say, I register a ProcessEventListener on my ksession and in afterProcessCompleted I want to delete the process instance, so that it disappears completely from the JBPM DB. What is the way to do it?

       

      TIA

      Oleg

        • 1. Re: how to delete a process instance
          kornilovs

          Maybe you can use stateless ksession?

          • 2. Re: how to delete a process instance

            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?

            • 3. Re: how to delete a process instance
              kornilovs

              ksession = kbase.newStatelessKnowledgeSession();

               

              i think it type of session don't save data to db

              • 4. Re: how to delete a process instance

                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??

                • 5. Re: how to delete a process instance
                  ashpcs

                  Hi Oleg,

                   

                  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. 

                  • 6. Re: how to delete a process instance

                    Hi Ashish,

                     

                    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.