jBPM3 Design Documentation

The purpose of this article is to gather design documents and diagrams together.

 

Design Diagrams

Product Components

jbpm3.components.png

Process definition and instance

procdef_procinst.png

Node hierarchy

nodetypes.png

Asynchronous node

async_node.png

Timer

job_executor.png

Project Modules

 

ModuleDescription
coreProcess engine codebase and the project test suite.
dbDatabase  schema  scripts for every version (since 3.2.2), plus the scripts to  generate the new jBPM DB schema scripts for every new version when it is  being released.
distribution

Product  installer. The idea was that this installer  would be the interface  between the project and the product. Instead, the SOA platform build  does an automated installation and then a script cherry picks files from  the installation.

enterpriseMessage and  scheduler services based on JMS and EJB timers respectively.  Those  services are not used in the product.   Instead, the JCA inflow services  are used.
examplesSample processes that ship with the product.
identityIdentity component containing the classes for users, groups and memberships.
simulationProcess analysis and optimization tool donated by Camunda GmbH. Not part of the product.

userguide

User  guide in the docbook format.  Note that these docs are decoupled from  the product  docs.  Changes must be propagated to the docs team  separately.

Tooling Interfaces

Graphical process designer

GPD depends on the file src/main/etc/version.info.xml in the distribution module. This file contains the locations of the jar files that are needed to create a new project. The tooling expects the following folder layout:

 

DirectoryContents
libbinaries and dependencies
srcsource jars
configconfiguration resources
examplessample processes

 

For deployment, a servlet that accepts process archives with file upload has to be configured.  This features was only added for usage during development.  So after we found out that this imposed a security problem, then we proposed to remove the servlet.  But the latest product decision was to secure the servlet.

Web console

The console just uses the jBPM 3 API and libraries directly and it should be configured to connect to a data source.

Database

Compatibility

jBPM uses Hibernate as ORM framework. This means that, theoretically, jBPM is compatible with any Hibernate-compatible database (ie any database for which there exists a Hibernate dialect). However, extensive compatibility testing is done on the databases which are listed as certified databases for the SOA-P (and more).

 

jBPM is continuously evaluated with the relational database systems listed in jBPM3 Platform Support.

Schema

The following sections will discuss the jBPM schema. Refer to Jbpm31DataModel for diagrams of the definition and execution data models.

Definition data
  • JBPM_PROCESSDEFINITION: general process definition data (name, description, etc).
  • JBPM_NODE: data about one node in the process definition. All node types will store common data in this table.
  • JBPM_TRANSITION: every record in this table represents one transition between two nodes of the process definition.
  • JBPM_EVENT: static data about events that are triggered during process execution.
  • JBPM_ACTION: user code related to the process definition.
  • JBPM_DELEGATION: information about user code that uses delegation classes.
  • JBPM_EXCEPTIONHANDLER: information about exception handlers attached to certain process definition scopes. Relates to JBPM_ACTION for the actual delegation to custom Java exception handlers.
  • JBPM_VARIABLEACCESS: stores the read/write and mapping information for variables when variables are passed to for example subprocesses.
  • JBPM_TASK: contains static information about tasks: task name, properties (blocking, duedate, etc.), assignee expression.
  • JBPM_MODULEDEFINITION: generic table that stores for example (a part of) a task definition, a process definition start task, etc.
  • JBPM_SWIMLANE: static description of a task swimlane. Contains an expression or a reference to a delegation class for the actual assignment at runtime.
  • JBPM_TASKCONTROLLER: Stores the reference to a user code delegation class that implements task controller functionality.
  • JBPM_ID_USER/GROUP/MEMBERSHIP: user/group data for the default identity component
Execution data
  • JBPM_PROCESSINSTANCE: general data about an execution of a process definition.
  • JBPM_TOKEN: stores the actual pointers that indicate the current state of a process instance. The jBPM model is based on a hierarchical tree of tokens. The JBPM_PROCESSINSTANCE table refers to a so-called 'root-token' that is created when the process instance is created. The tree of tokens can be constructed using this token-rootToken-processInstance relationship.
  • JBPM_VARIABLEINSTANCE: runtime data in the form of process variables are stored in this table. Multiple columns such as 'datevalue_', 'longvalue_', 'stringvalue_', etc are used to store the actual variables depending on the variable types.
  • JBPM_BYTEARRAY/JBPM_BYTEBLOCK: tables used to store binary data (eg binary variables).
  • JBPM_SWIMLANEINSTANCE: contains runtime evaluations of assignment expressions/delegations.
  • JBPM_TASKINSTANCE: runtime tasks (ie with a runtime actor and token reference).
  • JBPM_POOLEDACTOR/JBPM_TASKACTORPOOL: when task assignment expressions resolve to a group of actors (a so-called 'pool of actors'), the runtime evaluations are stored in these two tables.
  • JBPM_JOB: stores runtime job information that is used to execute jobs, and in particular asynchronous continuations of process logic, by the job executor.
  • JBPM_TIMER: timers are a specific type of jobs that are executable by the jBPM job executor. However, timers need additional information such as 'transitionName' (transition taken when te timer fires), the task to which the timer is attached to, etc. All this extra runtime information is stored in this table.
  • JBPM_LOG: generic table that contains all historical/audit data generated by the jBPM engine. This table has quite some columns to store the different types of historical events. At runtime, this table can get seriously big, and maintenance scripts should be developed to keep performance decent.

API Usage

Starting a process instance

jbpm3.api.sequence.start.process.instance.png

Signaling a token

jbpm3.api.sequence.signal.png

Retrieving a task list

jbpm3.api.sequence.task.list.png

Test Coverage

Continuous integration

The project leverages the Hudson installation maintained by JBoss QA. The codebase also provides scripts and configuration files to set up a local Hudson server useful for troubleshooting purposes. Visit jBPM3 Hudson Setup for a step-by-step guide.

Areas of attention

From support cases, our experience is that only one set of tests is lacking: Controlled concurrency testing.  Though those are not easy to set up.  This means that we need to simulate in a controlled fashion optimistic locking exceptions.  One test thread should control multiple threads (at minimal 2), each performing some competing operation on jBPM.  For example, a signal and a timer that are performed on the same token.  Those then should lead to a hibernate optimistic locking exception and then a rollback of one of those transactions.  Depending on the DB implementation of locking, deadlocks could arise as well.  Analyzing which of those situations can occur and building controlled tests for those is the next effort that should be done for jBPM to be able to better support the product.  Also the join behavior should get attention in this context. Then these tests should be executed on all databases so that those different behaviors can be analyzed and documented.

A significant amount of research is necessary to explore this path.  One direction we've been thinking about is using the java debugger capabilities to achieve this.  In that case, the unit test could pretend to be a debugging tool that puts breakpoints and steers the execution in a controlled fashion to optimistic locking exceptions.