You can suspend long-running, top-level process instance while
it is running and resume it again to complete it.
Before you begin
The caller must be an administrator of the process instance or a business
process administrator. To suspend a process instance, it must be in the running
or failing state.
Why and when to perform this task
You might want to suspend a process instance, for example, so
that you can configure access to a back-end system that is used later in the
process. When the prerequisites for the process are met, you can resume the
process instance. You might also want to suspend a process
to fix a problem that is causing the process instance to fail, and then resume
it again when the problem is fixed.
Steps for this task
- Get the running process, CustomerOrder, that you want to suspend.
ProcessInstanceData processInstance =
process.getProcessInstance("CustomerOrder");
- Suspend the process instance.
PIID piid = processInstance.getID();
process.suspend( piid );
This action suspends the
specified top-level process instance. The process instance is put into the
suspended state. Subprocesses with the autonomy attribute set to child are
also suspended if they are in the running, failing, terminating, or compensating
state. Inline tasks that are associated with this process instance are also
suspended; standalone tasks associated with this process instance
are not suspended.
In this state, activities that are started can still
be finished but no new activities are activated, for example, a staff activity
in the claimed state can be completed.
- Resume the process instance.
process.resume( piid );
This action puts the process instance and its subprocesses
into the states they had before they were suspended.