2 Replies Latest reply on Dec 7, 2006 10:30 PM by Katherine Degerberg

    Deleting processInstance as part of workflow

    Katherine Degerberg Newbie

      As the last step in the workflow (at or right before end-state) I would like to delete the processInstance. Basically, I don't want any ended processIntances in the database.

      I tried re-defining end-state, and I thought I had correctly changed all the configuration files, but my process wouldn't deploy correctly.

      My question is, is end-state required, or could I not have an end-state node in the process definition, and instead define a node that would essentially end the task and delete the processInstance? I looked at the source code for the EndState node, and it doesn't seem to do anything special, but I'm more concerned about what might be happening outside the node class.

      If eliminating end-state is not possible could someone who is using deleteProcessInstance explain when/how they use it? I could of course create an process outside of the flow to query the database for completed processes and then use deleteProcessInstance to clean them out, but that would require additional queries against the database. We are running an extremely large number of processes through the system, and I'm trying to limit unnecessary queries (if possible).

      Any suggestions would be welcome.

        • 1. Re: Deleting processInstance as part of workflow
          Tom Baeyens Master

          you could try a hibernate synchronization. just before the transaction commits, flush and then use deleteProcessInstance

          but it is a valid feature request. i'll think about how we can make this easier in later versions.

          • 2. Re: Deleting processInstance as part of workflow
            Katherine Degerberg Newbie

            I think an end-state that would clean up the processInstance would be useful to systems that don't need to keep a history, like ours.

            I have figured out some of the answers to my questions (I think). I created a Node with an Action that ends the token, exactly as EndState does. It also calls deleteProcessInstance which is what I wanted. I'm not seeing any bad side affects yet so this solution may work for us.

            The only issue I have right now is that not all the entries in the JPBM_BYTEARRAY and JBPM_BYTEBLOCK table are being removed. I believe this may have something to do with the Map being saved multiple times during the process flow, and that somehow ByteArray values are not correctly removed from the database if they are updated. I'm going to keep investigating this issue, as these two tables are causing most of our problems.