Runtime Information

Activities that perform some application related work (as opposed to workflow engine only work such as route and end process activities) require a clear transactional boundary between the engine and application code. It is also useful to have asynchronous invocations between the workflow engine and the application (e.g. a user should not have to wait while workflow transitions to the next activity before control is returned to them in the user interface).

To this end, there are three distinct functions present in a workflow activity, start(), execute() and complete(). After the completion of an activity in the workflow process instance, the workflow engine calls the function to continue the process. This function evaluates the outgoing transitions from that activity to determine which one(s) will be followed.

For each activity to be followed, the corresponding start() function is called. The appropriate activity instance data is then set up for that activity. If the activity is to be executed directly with no JMS (Java Message Service (JMS) API is a part of Java EE) messaging required (i.e. a route activity is always executed directly as there is no application related work involved), the execute() method is called here. Otherwise, a JMS message is sent to execute the specified activity (i.e. an automatic activity). The workflow message handler resolves the process and activity specified in the message and calls the execute() function on the activity.

After calling the application code to carry out the work specified by the activity, another message is sent to complete the activity. Again, the workflow message handler resolves the process and activity specified in the message and calls the complete function for the activity. After marking the activity as complete, the function to continue the process is called again to resolve the set of transitions to be followed from the completed activity and the process begins again.