Deleting process instances

Completed process instances are automatically deleted from the Business Process Choreographer database if the corresponding property is set for the process template in the process model. You might want to keep process instances in your database, for example, to query data from process instances that are not written to the audit log. However, stored process instance data does not only impact disk space and performance but also prevents process instances that use the same correlation set values from being created. Therefore, you should regularly delete process instance data from the database.

Why and when to perform this task

To delete a process instance, you need process administrator rights and the process instance must be a top-level process instance.

The following example shows how to delete all of the finished process instances.

Steps for this task

  1. List the process instances that are finished.
    QueryResultSet result = 
         process.query("DISTINCT PROCESS_INSTANCE.PIID",
                       "PROCESS_INSTANCE.STATE = 
                                PROCESS_INSTANCE.STATE.STATE_FINISHED", 
                        (String)null, (Integer)null, (TimeZone)null);

    This action returns a query result set that lists process instances that are finished.

  2. Delete the process instances that are finished.
    while (result.next() )
    {
    	  PIID piid = (PIID) result.getOID(1);
    	  process.delete(piid);
    }
    This action deletes the selected process instance and its inline tasks from the database.
Related concepts
Queries on business-process and task-related objects

Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)