Pausing Workflow Processing for Spawned Processes

This chapter describes the usage of a variant HALT of spawn option for the WorkflowService method spawnPeerProcessInstance(long processInstanceOid, String spawnProcessID, SpawnOptions options):

/**
    * Creates a new SpawnOption that allows to specify the starting activity and detailed data copy options.
    *
    * @param startActivity the activity from which the spawned process instance should start.
    *        If null, the spawned process instance will start from the default start activity.
    * @param spawnMode specifies what action to take with the originating process instance. {@link SpawnMode#Keep}, {@link SpawnMode#ABORT} or {@link SpawnMode#HALT}.
    * @param comment a comment describing the operation. May be null.
    * @param dataCopyOptions instructions on how the data should be transferred from the
    *        originating process instance to the spawned process instance. If null, then
    *        {@link DataCopyOptions.DEFAULT} is used.
    */
   public SpawnOptions(String startActivity, SpawnMode spawnMode, String comment,
         DataCopyOptions dataCopyOptions)

Using this option, you can set the SpawnMode to HALT. In this state, no transition is allowed via workflowservice API until the process is resumed. In this case, following would be the behavior:

To specify the spawn mode, use the following Enum constant:

public enum SpawnMode
   {
      KEEP,
      ABORT,
      HALT
   }

For more information, please refer to the JavaDoc of SpawnOptions class.

Resuming

Completion of a process checks for a PredefinedProcessInstanceLinkTypes#INSERT link and starts a resume on the linked source process. The linked source process is resumed if all of its linked target processes are already terminated.

Note that when using the API to halt a process, you may get a ConcurrencyException. In that case, wait for some time and retry the API call.