The Process Call Chain

Support for main process, sub processes and process routes

Recently I came accross a script that used the following code with ExecutionTask :

ExecutionTask currentProcessExecution = ExecutionManager.getCurrent()
_logger.info( "*** Script hosting process name  : " +  currentProcessExecution.getProcessName())

ExecutionTask t = currentProcessExecution
while( t.getParent() != null) t = t.getParent()

_logger.info( "*** Top-Process Name : " +  t.getProcessName())

// *** Script hosting process name  : subPr.subProcess_01_01
// *** Top-Process Name             : Custom Main Process

The Basics

A script is hosted in a process. This process can be a sub-process of another process(es).

For example:

  • Main Process calls (Level -2)

    • subProcess01 routes to (Level -1)

      • subPr.subProcess_01_01, where the script runs on! (Level 0)

The ExecutionProperties EXECUTION_ID, PROCESS_ID, PROCESS_NAME refer to the script's (hosting) process.

What you need to undestand is, that each process execution has its own ExecutionTask object with different properties, and you can traverse up the hierarchy using the getParent() method.

Process Name = subPr.subProcess_01_01

Process Name = subProcess01

Process Name = Main

How to define a process call hierarchy in a Test

import msPro.scriptease.* // Important

Process Id (=Component Id) are set to a randowm Guid by default. This can be overridden in the ProcessExecutionProperties constructor.

StartTime and executionId are set a atuomatically.

Last updated