User Guide
The User Guide for Red Hat JBoss BPM Suite
Abstract
Chapter 1. Introduction
1.1. Use Case: Process-based solutions in the loan industry

Figure 1.1. High-level loan application process flow

Figure 1.2. Loan Application Process Automation
1.2. Components
- Business Central, which is a web-based application (
business-central.waranddashbuilder.war) and provides tools for creating, editing, building, managing, and monitoring of business assets as well as a Task client - Artifact repository (Knowledge Store), which is the set of data the application operates over and is accessed by the Execution Server
- Execution Server, which provides the runtime environment for business assets
1.3. Red Hat JBoss BPM Suite and BRMS
1.4. Business Central
- Process management capabilities allow you to start new process instances, acquire the list of running process instances, inspect the state of a specific process instances, etc.
- User Task management capabilities allow you to work with User Tasks; claim User Tasks, complete Tasks through Task forms, etc.
- Process Designer and other editors for modeling Processes and their resources (form item editor, work item editor, data model editor, etc.), as well as process model simulation tools (refer to Chapter 4, Process Designer)
- Rules Modeler for designing Business Rules models and their resources (refer to Red Hat JBoss BRMS documentation)
- Task client for managing and creating User Tasks (refer to Section 10.2, “User tasks”)
- Process Manager for managing process instances (refer to Section 10.1, “Process instances”)
- Dashboard Builder, the BAM component, for monitoring and reporting (refer to Chapter 13, Red Hat JBoss Dashboard Builder)
- Business Asset Manager for accessing the Knowledge Repository resources, building and deploying business assets (refer to Chapter 3, Project)Artifact repository (Knowledge Store) is the set of data over which Business Central operates. It provides a centralized store for your business knowledge, which can consist of multiple repositories with business assets and resources (for further information, refer to the Red Hat JBoss BPM Suite Administration and Configuration Guide).
- Process Definitions displays the Process Definition List with the Process definitions available in the connected repository.
- Process Instances displays the Process Instance List with the Process instances currently running on the Process Engine.
- Tasks displays a view of the Tasks list for the currently logged-in user. You can call a Task List in the grid view or in the calendar view from the menu.
1.4.1. Business Central Environment

|
The main menu contains the links to the Home page and all available perspectives.
|
|
The perspective menu contains menus for the selected perspective (here it is empty; note that the content differs for individual perspectives) Section 1.4.2, “Perspectives”.
|
|
The perspective area contains the perspective tools (here the home page with links to individual perspectives and their views), such as views and editors.
|
Figure 1.3. Home page
1.4.2. Perspectives
- group:
- Project Authoring perspective contains the Project Explorer view (by default on the left) with the overview of available repository structure, and information on available resources, such as, business process definitions, form definitions, etc.; the editor area on the right, where the respective editor appears when a resource is opened; and the Messages view with validation messages.
- Artifact Repository perspective contains a list of jars which can be added as dependencies. The available operations in this perspective are upload/download artifact and open (view) the
pom.xmlfile. - Administration perspective (available only for users with the
ADMINrole) contains the File Explorer view (by default on the left) with available asset repositories; the editor area on the right, where the respective editor appears when a resource is opened. The perspective allows an administrator to connect Knowledge Store to a repository with assets and to create a new repository (refer to Administration and Configuration Guide).
- group:
- Deployments perspective contains a list of the deployed resources and allows you to build and deploy an undeploy new units.
- group:
- Process Definitions perspective contains a list of the deployed Process definitions. It allows you to instantiate and manage the deployed Processes.
- Process Instances perspective contains a list of the instantiated Processes. It allows you to view their execution worklow and its history.
- group:
- Task List perspective contains a list of Tasks produced by Human Task of the Process instances or produced manually. Only Tasks assigned to the logged-in user are visible. It allows you to claim Tasks assigned to a group you are a member of.
- group (the BAM component):
- Process & Task Dashboard perspective contains a prepared dashboard with statistics on runtime data of the Execution Server
- Business Dashboards perspective contains the full BAM component, the Dashbuilder, including administration features available for users with the
ADMINrole.
1.4.3. Embedding Business Central
Table 1.1. HTTP Query Parameters for Standalone Mode
| Parameter Name | Explanation | Allow Multiple Values | Example |
|---|---|---|---|
| standalone | This parameter switches Business Central to standalone mode. | no | (none) |
| path | Path to the asset to be edited. Note that asset should already exists. | no | git://master@uf-playground/todo.md |
| perspective | Reference to an existing perspective name. | no | org.guvnor.m2repo.client.perspectives.GuvnorM2RepoPerspective |
| header | Defines the name of the header that should be displayed (useful for context menu headers). | yes | ComplementNavArea |
===test.html===
<html>
<head>
<title>Test</title>
</head>
<body>
<iframe id="ifrm" width="1920" height="1080" src='http://localhost:8080/business-central?standalone=&perspective=AuthoringPerspective&header=AppNavBar'></iframe>
</body>
</html>web.xml of business-central. The default value for x-frame-options is as follows:
<param-name>x-frame-options</param-name> <param-value>SAMEORIGIN</param-value>
Chapter 2. Basic concepts
dispose() call is not issued, the session remains alive and causes memory leaks. Also note that the FireAllRules command is not automatically called at the end of a stateful session.

Figure 2.1. Kie Base and Kie Session relationship
Part I. Modeling
Chapter 3. Project
pom.xml) with information on how to build the output artifact. It also contains the Module Descriptor file, kmodule.xml, that contains the KIE Base and KIE Session configuration for the assets in the project.
3.1. Creating a project
- Open the Project Authoring perspective: on the main menu, click → .
- In the Project Explorer, select the organizational unit and the repository where you want to create the project.
- In the perspective menu, go to → .
- In the Create new Project dialog window, define the project details:
- In the Project text box, enter the project name.

- The explorer refreshes to show a New Project Wizard pop-up window.

- Define the Project General Settings and Group artifact version details for this new project. These parameters are stored inside the
pom.xmlMaven configuration file.- Project Name: The name for the project; for example
MortgageProject - Project Description: The description of the project which may be useful for the project documentation purpose.
- Group ID: group ID of the project; for example
org.mycompany.commons - Artifact ID: artifact ID unique in the group; for example
myframework. Avoid using a space or any special character that might lead to an invalid name. - Version ID: version of the project; for example
2.1.1
The Project Screen view is updated with the new project details as defined in the pom.xml file. Note, that you can switch between project descriptor files in the drop down-box with Project Settings and Knowledge Base Setting, and edit their contents.
3.2. Adding dependencies
- Open the Project Editor for the given project:
- In the Project Explorer view of the
Project Authoringperspective, open the project directory. - Click on the
button to open the project view.
- In the Project Screen view, select in the Project Settings drop-down box the Dependencies item.
- On the updated Project Screen, click the button to add a maven dependency or click the button to add a dependency from the Knowledge Store (Artifact repository):
- When adding a maven dependency, a user has to define the Group ID, Artifact ID and the Version ID in the new row which is created in the dependency table.
- When adding a dependency from the Knowledge Store, select the dependency in the displayed dialog box: the dependency will be added to the dependency table.
- To apply the various changes, the dependencies must be saved.
Warning
3.3. Defining Kie Base
kmodule.xml project descriptor file of your project via the Project Editor.
Defining Kie Base in the Project Editor
kmodule.xml file, do the following:
- To open Project Explorer, click and select or navigate to your project.
- Open your project properties in Project Editor: in the perspective menu, click → .
- In the drop-down menu on the Project Screen view, click Knowledge bases and sessions.

Figure 3.1. Project properties selection
- In the Knowledge Bases area on the updated Project Screen, define and select the Knowledge (Kie) Base definition.

Figure 3.2. New Knowledge Base created
Defining Kie Base using API
import org.kie.api.KieServices;
import org.kie.api.builder.KieRepository;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.KieBuilder;
import org.kie.api.runtime.KieContainer;
import org.kie.api.KieBase;
...
KieServices kServices = KieServices.Factory.get();
KieRepository kRepository = kServices.getRepository();
KieFileSystem kFileSystem = kServices.newKieFileSystem();
kFileSystem.write(ResourceFactory.newClassPathResource("MyProcess.bpmn"));
KieBuilder kBuilder = kServices.newKieBuilder(kFileSystem);
kBuilder.buildAll();
KieContainer kContainer = kServices.newKieContainer(kRepository.getDefaultReleaseId());
KieBase kBase = kContainer.getKieBase();3.4. Defining Sessions
kmodule.xml project descriptor file of your project via the Project Editor.
Defining Kie Session using API
Example 3.1. Creating a Kie Session and starting a MyProcess instance
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.process.ProcessInstance;
...
KieSession ksession = kBase.newKieSession();
ProcessInstance processInstance = ksession.startProcess("com.sample.MyProcess");
ProcessRuntime interface that the Kie Sesssions implement.
ProcessRuntime methods
- ProcessInstance startProcess(String processId);
- The method starts a new Process instance of the process with the specified ID and returns the ProcessInstance reference
- ProcessInstance startProcess(String processId, Map<String, Object> parameters);
- The method starts a new process instance of the process with the specified ID and returns the ProcessInstance reference. Additional parameters provided as a Map (as name-value pairs) are set as variables of the process instance.
- void signalEvent(String type, Object event);
- The method signals the Process Engine that an event of the defined type has occurred. The event parameter can contain additional information related to the event. All process instances that are listening to this type of external event are notified. For performance reasons, it is recommended to use this type of event signaling only if exactly one process instance is able to notify other process instances. For internal event within one process instance, use the signalEvent method that also includes the processInstanceId of the respective process instance.
- void signalEvent(String type, Object event, long processInstanceId);
- The method signals to a Process instance that an event has occurred. The type parameter defines which type of event and the event parameter can contain additional information related to the event. All node instances inside the given Process instance that are listening to this type of (internal) event are notified. Note that the event is only processed inside the given Process instance. No other Process instances waiting for this type of event are notified.
- Collection<ProcessInstance> getProcessInstances();
- The method returns a collection of the currently active Process instaces. Only Process instances that are currently loaded and active in the Process Engine are returned. When using persistence, the persisted Process instances are not returned. It is recommended to use the history log to collect the information about the state of your Process instances instead.
- ProcessInstance getProcessInstance(long processInstanceId);
- The method returns the Process instance with the given id. Only active Process instances are returned: if a Process instance has been completed, the method returns
null. - void abortProcessInstance(long processInstanceId);
- The method aborts the Process instance with the given ID. If the Process instance has been completed or aborted, or it cannot be found, the method throws an IllegalArgumentException.
- WorkItemManager getWorkItemManager();
- The method returns the WorkItemManager related to the Kie Session. The returned object reference can be used to register new WorkItemHandlers or to complete or abort WorkItems.
Defining Kie Session in the Project Editor
kmodule.xml file, do the following:
- Open your project properties with the Project Editor: in the Project Explorer, locate your project root. In the perspective menu, go to → .
- In the drop-down box of the Project Screen view, click Knowledge bases and sessions.
- On the left side, select .
- You can now add a new ksession and set default, state, and clock.
3.5. Creating a resource
Note
- In the Repository view of the Project Explorer, navigate to the
REPOSITORY/PROJECT/src/main/resources/directory. - Go to → .
- In the New resource dialog, define the package name and check the location of the package in the repository.
3.6. Asset Metadata and Versioning
Metadata Management

Categories, Subject, Type, External Link and Source metadata for that asset. However, the most interesting metadata is the description of the asset that you can view/edit in the description field and the comments that you and other people with access to this asset can enter and view.
Important
Version Management
- Click the button in the asset toolbar and select the version that you are interested in. Business Central will load this version of the asset.

- Alternatively, open up the Overview section. The Version history section shows you all the available versions. the version that you want to restore.
3.7. Process definition
Example 3.2. BPMN2 source of a Process definition
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"Rule Task
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process>
PROCESS
</process>
<bpmndi:BPMNDiagram>
BPMN DIAGRAM DEFINITION
</bpmndi:BPMNDiagram>
</definitions>3.7.1. Creating a Process definition
- Open the Project Authoring perspective ( → ).
- In
Project Explorer( → ), navigate to the project where you want to create the Process definition (in the Project view, select the respective repository and project in the drop-down lists; in the Repository view, navigate toREPOSITORY/PROJECT/src/main/resources/directory).Note
It is recommended to create your resources, including your Process definitions, in a package of a Project to allow importing of resources and their referencing. To create a package, do the following:- In the Repository view of the Project Explorer, navigate to the
REPOSITORY/PROJECT/src/main/resources/directory. - Go to → .
- In the New resource dialog, define the package name and check the location of the package in the repository.
- From the perspective menu, go to → .
- In the New Processes dialog box, enter the Process name and click . Wait until the Process Editor with the Process diagram appears.
3.7.2. Importing a Process definition
- In the Project Explorer, select a Project and the respective package to which you want to import the Process definition.
- Create a new Business Process to work in by going to → .
- In the Process Designer toolbar, click the Import
icon in the editor toolbar and pick the format of the imported process definition. Note that you have to choose to overwrite the existing process definition in order to import.
- From the Import window, locate the Process file and click .

Figure 3.3. Import Window
3.7.3. Importing jPDL 3.2 to BPMN2

Figure 3.4. Migrate jPDL 3.2 to BPMN2

Figure 3.5. Migrate to BPMN2 dialog box
Important
3.7.4. Deleting a Process definition
) and then (
).
3.8. System Properties
Table 3.1. System Properties
| Property | Description |
|---|---|
| org.uberfire.nio.git.dir | Location of the directory .niogit. Default: working directory |
| org.uberfire.nio.git.daemon.enabled | Enables/disables git daemon. Default: true |
| org.uberfire.nio.git.daemon.host | If git daemon enabled, uses this property as local host identifier. Default: localhost |
| org.uberfire.nio.git.daemon.port | If git daemon enabled, uses this property as port number. Default: 9418 |
| org.uberfire.nio.git.ssh.enabled | Enables/disables ssh daemon. Default: true |
| org.uberfire.nio.git.ssh.host | If ssh daemon enabled, uses this property as local host identifier. Default: localhost |
| org.uberfire.nio.git.ssh.port | If ssh daemon enabled, uses this property as port number. Default: 8001 |
| org.uberfire.nio.git.ssh.cert.dir | Location of the directory .security where local certtificates will be stored. Default: working directory |
| org.uberfire.metadata.index.dir | Place where Lucene .index folder will be stored. Default: working directory |
| org.uberfire.cluster.id | Name of the helix cluster, for example: kie-cluster |
| org.uberfire.cluster.zk | Connection string to zookeeper. This is of the form host1:port1,host2:port2,host3:port3, for example: localhost:2188 |
| org.uberfire.cluster.vfs.lock | Name of the resource defined on helix cluster, for example: kie-vfs |
| org.uberfire.cluster.autostart | Delays VFS clustering until the application is fully initialized to avoid conflicts when all cluster members create local clones. Default: false |
| org.uberfire.sys.repo.monitor.disabled | Disable configuration monitor (do not disable unless you know what you're doing). Default: false |
| org.uberfire.secure.key | Secret password used by password encryption. Default: org.uberfire.admin |
| org.uberfire.secure.alg | Crypto algorithm used by password encryption. Default: PBEWithMD5AndDES |
| org.uberfire.domain | Security-domain name used by uberfire. Default: ApplicationRealm |
| org.guvnor.m2repo.dir | Place where Maven repository folder will be stored. Default: working-directory/repositories/kie |
| org.kie.example.repositories | Folder from where demo repositories will be cloned. The demo repositories need to have been obtained and placed in this folder. Demo repositories can be obtained from the kie-wb-6.2.0-SNAPSHOT-example-repositories.zip artifact. This System Property takes precedence over org.kie.demo and org.kie.example. Default: Not used. |
| org.kie.demo | Enables external clone of a demo application from GitHub. This System Property takes precedence over org.kie.example. Default: true |
| org.kie.example | Enables example structure composed by Repository, Organization Unit and Project. Default: false |
- Edit the file $
JBOSS_HOME/domain/configuration/host.xml. - Locate the XML elements server that belong to the
main-server-groupand add a system property, for example:<system-properties> <property name="org.uberfire.nio.git.dir" value="..." boot-time="false"/> ... </system-properties>
Chapter 4. Process Designer
- JBoss Developer Studio Process Designer
- Thick-client version of the Process Designer integrated in the JBoss Developer Studio plug-in
- Web Process Designer
- Thin-client version of the Process Designer integrated in BPM Central
|
The canvas represents the process diagram. Here you can place the elements from the palette which will constitute the Process. Note that one Process definition may contain exactly one process diagram; therefore a Process definition equals to a Process diagram (this may differ in other products).
|
|
The Object Library (palette) contains groups of BPMN2 elements. Details on execution semantics and properties of individual BPMN2 shapes are available in Appendix A, Process Elements.
|
|
The Properties panel displays the properties of the selected element. If no element is selected, the panel contains Process properties.
|
|
The editor toolbar allows you to select an operation to be applied to the Elements on the canvas.
|
Figure 4.1. Process Designer environment
Note
. This will make your current editor fill the entire Business Central screen. To go back, simply click the button again.
4.1. Configuring automatic saving

Figure 4.2. Enable autosave
4.2. Defining Process properties
- Open the Process file in the Process Designer.
- Click anywhere on the canvas: make sure, no Process element is selected.
Important
Do not use Unicode characters when defining the Process name or the Process ID: usage of such characters is not supported and results in unexpected behavior of the Process designer when saving and retrieving Process assets. - Expand the Properties panel on the left if applicable and define the Process properties on the tab by clicking individual entries. For entries that require other input that just string input, the respective editors can be user by clicking the arrow icon. Note that the editors for complex fields mostly provide validation and auto-completion features.

Figure 4.3. Opening the variable editor
- To save your changes, click File and Save changes
4.3. Designing a Process
- In the Project view of the Project Explorer, select your Project and click the respective Process under Business Processes. Alternatively, locate the process definition in the Repository view of the Project Explorer and double-click the file to open it in the Process Designer.
- Add the required shapes to the process diagram on the canvas:
- Drag and drop the shapes from the Object Library palette to the required position on the canvas.

Figure 4.4. Object Library
- Select a shape already placed on the canvas: the quick linker menu appears. The quick linker feature displays only the elements that can be connected to the selected shape and connects them with a valid Association element.
Note
To change the type of an already placed element to an element that extends this element, click it and select the Morph shape (
) icon.
- Double-click an element to provide its Name. Consider defining the element properties in the Properties view.
- Repeat the previous step until the Process Diagram defines the required workflow.
4.3.1. Aligning Elements
:
- Bottom: the selected elements will be aligned with the element located at the lowest position
- Middle: the selected elements will be aligned to the middle relative to the highest and lowest element
- Top: the selected elements will be aligned with the element located at the highest position
- Left: the selected elements will be aligned with the leftmost element
- Center: the selected elements will be aligned to the center relative to the leftmost and rightmost element
- Right: the selected elements will be aligned with the rightmost element
4.3.2. Changing Element layering
- Bring To Front : bring the selected element to foreground to the uppermost layer
- Bring To Back : send the selected element to background to the lowest layer
- Bring Forward : bring the selected element to foreground by one layer
- Bring Backward : send the selected element to background by one layer
- Center : the selected elements will be aligned to the center relative to the leftmost and rightmost element
- Right : the selected elements will be aligned with the rightmost element
4.3.3. Bending Connection Elements
button in the toolbar and then click the respective Docker. Once you delete dockers of a Connection object, no more dockers will be created automatically.
4.3.4. Resizing Elements
icon in the toolbar and then click on : all Elements will be resized to the size of the largest selected Element.
4.3.5. Grouping Elements
button in the toolbar. To ungroup such elements, select the group and click the
button.
4.3.6. Locking Elements
button in the toolbar. To unlock such Element, select them and click the
button in the toolbar.
4.3.7. Changing the color scheme
themes.json file, which is located in the global directory of each repository.
Procedure 4.1. Creating a new color schema
- Locate your project in the Project Explorer and switch to the Repository view.
- Open the
globaldirectory and locate and open thethemes.jsonfile. - In the displayed Default Editor, add your theme definition at the end of the file and click the button.
button in the toolbar and select the respective color scheme from the drop-down menu.
4.3.8. Recording local history
button and select entry. From this menu, you can also display the local history records and apply the respective status to the Process as well as disable the feature or clear the current local history log.
4.3.9. Enlarging and shrinking canvas
4.3.10. Validating a Process
) button in the toolbar of the Process Designer with the Process and click . If validation errors have been detected, the elements with errors are highlighted in orange. Click on the invalid element on the canvas to display a dialog with the summary of its validation errors. To disable continuous validation, click the (
) button in the toolbar of the Process Designer with the Process and click .
) button in the toolbar of the Process Designer with the Process and click .

Figure 4.5. Stopping continuous validation
4.4. Exporting a Process

Figure 4.6. Export Icon
- - Generates PNG file into the repository.
- - Generates PDF file into the repository.
- - Generates PNG file into the repository and the browser starts downloading this file.
- - Generates PDF file into the repository and the browser starts downloading this file.
- - Opens the "Process Sources" dialog box which contains the BPMN2, JSON, SVG, and ERDF source codes. The "Download BPMN2" button allows the user to download BPMN2 files. Pressing CTRL+A allows you to select the source code in a particular format. Pressing CTRL+F enables the find tool (Use /re/ syntax for regexp search).

Figure 4.7. Process Sources
4.5. Process elements
4.5.1. Generic properties of visualized Process elements
- Background
- The background color of the element in the diagram
- Border color
- The border color of the element in the diagram
- Font color
- The color of the font in the element name
- Font size
- The size of the font in the element name
- Name
- The element name displayed on the BPMN diagram
4.5.2. Defining Process elements properties
- Core properties, which include the basic properties of an element (typically Name, Data Set, Scripts, etc.).
- Extra properties, which include the properties necessary for the element execution (refer to Section A.6, “Process Elements”), data mapping (variable mapping) and local variable definitions (see Section 4.8.1, “Globals”), properties that represent an extension of the jBPM engine, typically onExitAction, Documentation, etc.
- Graphical properties, which include graphical representation of elements (colors, text settings).
- Simulation properties are used by the Simulation engine.
#{expression} to embed a value. The value will be retrieved on element instantiation, and the substitution expression will be replaced with the result of calling the toString() method on the variable defined in the expression. The expression could be the name of a variable (in which case it resolves to the value of the variable), but more advanced MVEL expressions are possible as well, e.g., #{person.name.firstname}.
- Open the Process definition in the Process Designer:
- On the canvas, select the Element.
- Click the double arrow (
) in the upper left corner of the Process Designer to display the Properties view.
- In the displayed Properties view, click the property value fields to edit them. Note that where applicable, you can click the drop-down arrow and the relevant value editor appears in a new dialog box.
- To save your changes, click the Save icon and select option Save.
4.6. Forms
form is a layout definition for a page (defined as HTML) that is displayed as a dialog window to the user on a
process instantiationor atask instantiation.
Process form or a Task form. It serves for acquiring data for the Element instance execution, be it a Process or Task, from a human user: a Process form can take as its input and output Process variables; a Task form can take as its input DataInputSet variables with assignment defined, and as its output DataOutputSet variables with assignment defined.
4.6.1. Defining Process form
- Open your Process definition in the Process Designer.
- In the editor toolbar, click the
Form(
) icon and then Edit Process Form. - Select the editor to use to edit the form. Note that this document deals only with the option.
4.6.2. Defining Task form
- Open your Process definition with the User Task in the Process Designer.
- Select the Task on the canvas and click the
Edit Process Form(
) in the User Task menu.
- In the displayed Form Editor, define the Task form.
4.6.3. Defining form fields
Note
4.7. Form Modeler
- Form Modeling WYSIWYG UI for forms
- Form autogeneration from data model / Java objects
- Data binding for Java objects
- Formula and expressions
- Customized forms layouts
- Forms embedding

Figure 4.8. Adding fields by origin

Figure 4.9. Adding classes from data model
4.7.1. Creating a Form in Form Modeler
- In Business Central, go to → .
- On the perspective menu, select → .
- In the dialog that opens, fill out the name of your form in and click .
button to place the field types onto the canvas, where you can modify them. To modify the field types, use the icons that display when you place the cursor over a field: , , , , , or . The icons enable you to change the order of the fields in the form, group the fields, or clear and edit their content.

Figure 4.10. New form
4.7.2. Opening an Existing Form in Form Modeler

Figure 4.11. Opening an Existing Form
4.7.3. Setting Properties of a Form Field in Form Modeler
- In Form Modeler, select the tab and click the arrow
button to the right of a field type. The field type is added to the canvas.
- On the canvas, place the cursor on the field and click the edit
icon.
- In the dialog that opens on the right, set the form field properties and click at the bottom of the dialog for HTML Labels. For other form field properties, the properties change once you have removed focus from the property that you are modifying.
4.7.4. Configuring a Process in Form Modeler
- Create process variables to hold values entered into forms. Variables can be simple (e.g. 'string') or complex. You can define complex variables using Data Modeler, or create them in any Java integrated development environment (Java IDE) as regular plain Java objects.
- Declare the process variables in the 'variables definition' property.
- Determine which variables you want to set as input parameters for the task, which shall receive response from the form, and establish mappings by setting the 'DataInputSet', 'DataOutputSet', and 'Assignments' properties for any human task. To do so, use the Editor for Data Input, Editor for Data Output, and Editor for Data Assignment.
Example 4.1. Defining a Variable using Data Modeler

4.7.5. Generating Forms from Task Definitions

Figure 4.12. Generating Forms Automatically
) located above a user task.

Figure 4.13.
formName-taskform in the same package as the process, the human task engine will use the form to display and capture information entered by the user. If you create a form named ProcessId-task, the application will use it as the initial form when starting the process.
4.7.6. Editing Forms
move fields, add new fields, configure fields, or set values for object properties.
4.7.7. Moving a Field in Form Modeler

Figure 4.14. Moving a Form Field in Form Modeler

Figure 4.15. Destination Areas to Move a Field
4.7.8. Adding New Fields to a Form

Figure 4.16. Adding Fields by Origin
Input binding expression and Output binding expression properties, so when the form is submitted, the values in the fields are stored in the corresponding data origin. The tab allows you to add fields to the form from the fields type palette of the Form Modeler. The fields do not store their value for any data origin until they have correct configuration of the Input binding expression and Output binding expression properties.

Figure 4.17. Adding Fields by Type
simple types are used to represent simple properties like texts, numeric values, or dates. The following table presents a complete list of supported simple field types:
Table 4.1. Simple Field Types
| Name | Description | Java Type | Default on generated forms |
|---|---|---|---|
| Short Text | Simple input to enter short texts. | java.lang.String | yes |
| Long Text | Text area to enter long text. | java.lang.String | no |
| Rich Text | HTML Editor to enter formatted texts. | java.lang.Srowing | no |
| Simple input to enter short text with email pattern. | java.lang.String | no | |
| Float | Input to enter short decimals. | java.lang.Float | yes |
| Decimal | Input to enter number with decimals. | java.lang.Double | yes |
| BigDecimal | Input to enter big decimal numbers. | java.math.BigDecimal | yes |
| BigInteger | Input to enter big integers. | java.math.BigInteger | yes |
| Short | Input to enter short integers. | java.lang.Short | yes |
| Integer | Input to enter integers. | java.lang.Integer | yes |
| Long Integer | Input to enter long integers. | java.lang.Long | yes |
| Checkbox | Checkbox to enter true/false values. | java.lang.Boolean | yes |
| Timestamp | Input to enter date and time values. | java.util.Date | yes |
| Short Date | Input to enter date values. | java.util.Date | no |
| Document | Allows the user to upload documents to the form. | org.jbpm.document.Document | No |
Complex field types are designed for work with properties that are not basic types but Java objects. To use these field types, it is necessary to create extra forms in order to display and write values to the specified Java objects.
Table 4.2. Complex Field Types
| Name | Description | Java Type | Default on generated forms |
|---|---|---|---|
| Simple subform | Renders the form; it is used to deal with 1:1 relationships. | java.lang.Object | yes |
| Multiple subform | This field type is used for 1:N relationships. It allows the user to create, edit, and delete a set child Objects.Text area to enter long text. | java.util.List | yes |
Decorators are a kind of field types that does not store data in the object displayed in the form. You can use them for decorative purposes.
Table 4.3. Decorators
| Name | Description |
|---|---|
| HTML label | Allows the user to create HTML code that will be rendered in the form. |
| Separator | Renders an HTML separator. |
4.7.9. Configuring Fields of a Form
Field Type- can change the field type to other compatible field types.Field Name- is used as an identifier in calculating of formulas.Label- the text that is displayed as a field label.Error Message- a message displayed when there is a problem with a field, for example in validation.Label CCS Class- allows you to enter a class css to apply in label visualization.Label CCS Style- allows you to directly enter the style to be applied to the label.Help Text- introduced text displayed as an alternative attribute to help the user in data introduction.Style Class- allows you to enter a class CSS to be applied in field visualization.CSS Style- allows you to directly enter the style to be applied to the label.Read Only- a field with this property allows reading only, no write access.Input Binding Expression- defines the link between the field and the process task input variable. In runtime, it is used to set the field value to the task input variable data.Output Binding Expression- defines the link between the field and the process task output variable. In runtime, it is used to set the task output variable.
4.7.10. Creating Subforms with Simple and Complex Field Types
Procedure 4.2. To create and insert a subform containing a single object inside a parent form:
- In Business Central, go to → .
- On the perspective menu, select → .A new form opens in the Form Modeler. You must now configure the new form with information of the object it must contain.
- Enter the values for the required fields in the Form data origin tab and click .

Figure 4.18. Create Subform
- Click Add fields by origin tab and add the listed fields to the form.

Figure 4.19. Add fields by origin
- Click the Edit icon on the field in the form to open the Properties tab.
- In the Properties tab, configure the form by providing required values to the fields and click to save the subform.
- Open the parent form to configure the properties of the object.
- In the parent form, click the Add fields by type tab. Select the object on the form and configure it in the Properties tab.
- In the Properties tab, select Simple subform for the Field type property. Then select the newly created subform for the Default form field property.

Figure 4.20. Configure the Parent Form
- Click to save the parent form.This inserts your subform containing a single Java object inside the parent form.
Procedure 4.3. To insert a subform with multiple objects inside a parent form:
- In Business Central, go to → .
- On the perspective menu, select → .A new form opens in the Form Modeler. You must now configure the new form with information on the object array it must contain.
- Enter the values for the required fields in the Form data origin tab and click .
- Click Add fields by origin tab and add the listed fields to the form.
- Click the Edit icon on the field in the form to open the Properties tab.
- In the Properties tab, configure the form by providing required values to the fields. You can use the Formula Engine to automatically calculate field values.
- Click to save the subform.
- Open the parent form to configure the properties of each of the objects.
- In the parent form, click the Add fields by type tab. Select each object on the form one by one and configure them in the Properties tab.
- In the Properties tab, select Multiple subform for the Field type property. Then select the newly created subform for the Default form field property.

Figure 4.21. Configure the Parent Form
- Click to save the parent form.This inserts your subform containing an array of Java objects inside the parent form.
4.7.11. Attaching Documents to a Form
Document form field. This field can be attached to any form, process or task based.
Document field to a form, click on it while creating or editing an existing form (in the Add fields by type section).

Document form fields based on the presence of a org.jbpm.document.Document variable type in your process.


Pluggable Variable Persistence
<marshalling-strategy> element. This element should name a type that provides an implementation of the org.kie.api.marshalling interface.
public boolean accept(Object object): Determines if the given object can be marshalled by the strategy.byte[] marshal( Context context, ObjectOutputStream os, Object object ): Marshals the given object and returns the marshalled object as byte[].Object unmarshal( Context context, ObjectInputStream is, byte[] object, ClassLoader classloader ): Reads the object received as byte[] and returns the unmarshalled objectvoid write(ObjectOutputStream os, Object object): same asmarshalmethod, provided for backwards compatibility.Object read(ObjectInputStream os): same asunmarshal, provided for backwards compatibility.
docs. This default implementation is defined by the DocumentStorageService class and is implemented through the DocumentStorageServiceImpl class.
4.7.12. Rendering Forms for External Use
4.7.12.1. JavaScript Library for Form Reuse
Blueprint for using the JavaScript Library
- Integrate the JavaScript library in the codebase for the external client application so that its functions are available.
- Create a new instance of the
jBPMFormsAPIclass in your own JavaScript code. This is the starting point for all interactions with this library.var jbpmRestAPI = new jBPMFormsAPI();
- Call your desired methods on this instance. For example, if you want to show a form, you would use the following method:
jbpmRestAPI.showStartProcessForm(hostUrl, deploymentId, processId, divId, onsuccess, onerror);
and provide the relevant details (hostUrl, deploymentId, processId and so on. A full list of the methods and parameters follows after this section). - Do post processing with the optional
onsuccessandonerrormethods. - Work with the form, starting processes (
startProcess()), claiming tasks (claimTask()) starting tasks (startTask()) or completing tasks (completeTask). Full list of available methods follows after this section. - Once you're finished with the form, clear the container that displayed it using
clearContainer()method.
Full list of available methods in the JavaScript Library
showStartProcessForm(hostUrl, deploymentId, processId, divId, onsuccessCallback, onerrorCallback):Makes a call to the REST endpoint to obtain the form URL. If it receives a valid response, it embeds the process start form in the stated div. You need these parameters:hostURL: The URL of the Business Central instance that holds the deployments.deploymentId: The deployment identifier that contains the process to run.processId: The identifier of the process to run.divId: The identifier of the div that has to contain the form.onsuccessCallback(optional): A JavaScript function executed if the form is going to be rendered. This function will receive the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to render the form. This function will receive the server response as a parameter.
startProcess(divId, onsuccessCallback, onerrorCallback):Submits the form loaded on the stated div and starts the process. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the process is started. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to start the process. This function receives the server response as a parameter.
showTaskForm(hostUrl, taskId, divId, onsuccessCallback, onerrorCallback):Makes a call to the REST endpoint to obtain the form URL. If it receives a valid response, it embeds the task form in the stated div. You need these parameters:hostURL: The URL of the Business Central instance that holds the deployments.taskId: The identifier of the task to show the form.divId: The identifier of the div that has to contain the form.onsuccessCallback(optional): A JavaScript function executed if the form is going to be rendered. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to render the form. This function receives the server response as a parameter.
claimTask(divId, onsuccessCallback, onerrorCallback):Claims the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
startTask(divId, onsuccessCallback, onerrorCallback):Starts the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
releaseTask(divId, onsuccessCallback, onerrorCallback):Releases the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
saveTask(divId, onsuccessCallback, onerrorCallback):Submits the form and saves the state of the task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
completeTask(divId, onsuccessCallback, onerrorCallback):Submits the form and completes task whose form is being rendered. You need these parameters:divId: The identifier of the div that contains the form.onsuccessCallback(optional): A JavaScript function executed after the task is claimed. This function receives the server response as a parameter.onerrorCallback(optional): A JavaScript function executed if any error occurs and it is impossible to claim the task. This function receives the server response as a parameter.
clearContainer(divId):Cleans the div content and the related data stored on the component. You need these parameters:divId: The identifier of the div that contains the form.
4.8. Variables
null and a write access produces an error message, and the Process continues its execution. Variables are searched for based on their ID.
- Session context:
Globalsare visible to all Process instances and assets in the given Session and are intended to be used primarily by business rules and by constrains. The are created dynamically by the rules or constrains. - Process context:
Process variablesare defined as properties in the BPMN2 definition file and are visible within the Process instance. They are initialized at Process creation and destroyed on Process finish. - Element context:
Local variablesare available within their Process element, such as an Activity. They are initialized when the element context is initialized, that is, when the execution workflow enters the node and execution of the OnEntry action finished if applicable. They are destroyed when the element context is destroyed, that is, when the execution workflow leaves the element.Values of local variables can be mapped to Global or Process variables using the Assignment mechanism (refer to Section 4.11, “Assignment”). This allows you to maintain relative independence of the parent Element that accommodates the local variable. Such isolation may help prevent technical exceptions.
4.8.1. Globals
Important
NullPointerException.
4.8.1.1. Creating Globals
Procedure 4.4. Defining a Global in the Process Designer
- Open the Process in the Process Designer.
- In the Properties panel of the BPMN Diagram expand the Extra item.
- Click the empty value cell next to the Globals and click the arrow.

Figure 4.22. Global properties cell
- In the Editor for Variable Definitions window, click the button and define the variable details.

Figure 4.23. Editor for Variable Definitions
Procedure 4.5. Defining and Initializing a Global using the API
- Define the variables as a Map of the <String, Object> values.
- Provide the map as a parameter to the
startProcess()method.
Example 4.2. Code instantiating a Process with a Global
Map<String, Object> params = new HashMap<String, Object>();
params.put("var", "variable value");
ksession.startProcess("Process Definition Name", params);4.8.1.2. Accessing Globals
processInstance.getContextInstance().getVariable("globalStatus")
4.8.1.3. Process variables
4.8.2. Local variables
Note
4.8.2.1. Accessing local variables
person.setAge(10) sets the Age field of the person global variable to 10.
4.9. Action scripts
kcontext. Accordingly, kcontext is an instance of ProcessContext class and the interface content can be found at the following location: Interface ProcessContext.
person.getName() is person.name. It also provides other improvements over Java and MVEL expressions are generally more convenient for the business user.
Example 4.3. Action script that prints out the name of the person
// Java dialect System.out.println( person.getName() ); // MVEL dialect System.out.println( person.name );
4.10. Interceptor actions
4.11. Assignment
Note
#{userVariable}, assignment is rather intended for mapping of properties that are not of type String.
4.11.1. Defining Assignments
Data Input- works only with Variables and Data Inputs.Data Output- works only with Variables and Data Outputs.
Assignments property, and then click the drop-down arrow. This will open up the Assignment Editor.

- Input Assignment: Lets you assign a Data Input to a literal value.
- Input Mapping: Lets you map a Data Input variable to an object.
- Output Mapping: Lets you map a Data Output variable to an object variable.
[din]DI1=65.0,[din]var1->DI2,[dout]DO1->var2
4.12. Constraints
true or false).
- Code constraints are defined either in Java or MVEL. They have access to data in the working memory, including the Globals and Process variables.
Example 4.4. Code constraint defined in Java
return person.getAge() > 20;
Example 4.5. Code constraint defined in MVEL
return person.age > 20;
- Rule constraints are defined in the form of BRMS rule conditions. They have access to data in the Working Memory, including the Globals. However, they cannot access the variables in its Process directly, but through the Process instance: to acquire the reference of the parent Process instance, use the
processInstancevariable of the typeWorkflowProcessInstance. Note that you need to insert the Process instance into the Session and update it if necessary, for example, using Java code or an on-entry or on-exit or explicit action in your Process.Example 4.6. Rule constraint with process variable assignment
import org.kie.api.runtime.process.ProcessInstance; import org.kie.api.runtime.process.WorkflowProcessInstance; ... processInstance : WorkflowProcessInstance() Person( name == ( processInstance.getVariable("name") ) )The rule constraint acquires the Process variablename.

Figure 4.24. Script Editor
return true;
4.13. Data models
Important
4.13.1. Data Modeler
Editor and Source tabs, along with source code preservation. This allows you to make changes to your model in external tools, like JBDS, and the Data Modeler updates the necessary code blocks automatically.
4.13.2. Creating a data object
- Open the Data Modeler: in the Project Authoring perspective, click → on the perspective menu. Enter the name (unique across the whole project and not just the package) and the location and press the button.
- Create fields of the data object:
- In the Create new field part of the Fields panel, define the field properties:
- Id: field ID unique within the data object
- Label: label to be used in the Fields panel
- Type: data type of the field
- Click .
Important
4.13.3. Annotations in Data Modeler
4.14. Domain-specific Tasks
custom work items or custom service nodes.
- work item handler
- The work item handler is a Java class that defines how to execute the custom task type. (Just like all Process elements, Tasks are executed in the Execution Engine (more precisely in the Task Engine), which contains a work item handler class, that defines how to handle the particular work item. Therefore, to allow the Execution Engine to execute your custom work item, you need to create a work item handler class for the custom work item and register it with the Execution Engine.)
- work item definition
- The work item definition defines how the custom task is presented (its name, icon, parameters).
Note
4.14.1. Work item definition
what part (the how part is implemented as a class that implements WorkItemHandler).
- Web Process Designer
- A work item definition is defined as an MVEL construct in a project resource (the custom work item node will appear on the palette; refer to Section 4.14.1.2, “Creating a work item definition”).
- JBoss Developer Studio Process Designer
- The BPMN2 <task> or <task>-type elements can be modified to work with
WorkItemHandlerimplementations.To do so, create aWID_NAME.widfile under theMETA-INFdirectory. (Example:$PROJECT_HOME/src/main/resources/META-INF/WID_NAME.wid). The contents of this file will be the same as the ones that you will create as if under Business Central (Web Process Designer). If there are any icons, create these icons under a folder$PROJECT_HOME/src/main/resources/, and store the icon images files iniconsfolder.Once you save this file, you can use your custom service task with the JBDS Process Designer. You can find your task in the category which is defined inWID_NAME.widfile.
- name unique in the given work item set
- description with arbitrary text
- version number
- parameters with a set of work item parameters used as properties
- displayName used in the palette
- icon with the path to the icon file for the Task element
- category the node is added to in the palette (if the defined category does not exit, a new category is created)
- defaultHandler with the class that implements the WorkItemHandler class and is used to execute the work item
- dependencies the defaultHandler requires for its execution
Important
Example 4.7. Calendar work item definition
import org.drools.core.process.core.datatype.impl.type.StringDataType;
[
[
"name" : "Google Calendar",
"description" : "Create a meeting in Google Calendar",
"version" : "1.0",
"parameters" : [
"FilePath" : new StringDataType(),
"User" : new StringDataType(),
"Password" : new StringDataType(),
"Body" : new StringDataType()
],
"displayName" : "Google Calendar",
"icon" : "calendar.gif",
"eclipse:customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor",
"category" : "Google",
"defaultHandler" : "org.jbpm.process.workitem.google.calendar.GoogleCalendarWorkItemHandler",
"dependencies" : [
]
]
]4.14.1.1. Work item handler
org.kie.api.runtime.process.WorkItemHandler interface.
Note
- The jbpm-bpm2 module in the org.jbpm.bpmn2.handler package contains the following work item handlers:
- ReceiveTaskHandler (for the BPMN <receiveTask> element)
- SendTaskHandler (for the BPMN <sendTask> element)
- ServiceTaskHandler (for the BPMN <serviceTask> element)
- The jbpm-workitems module in packages within org.jbpm.process.workitem contains work item handlers, some of which are listed below:
- ArchiveWorkItemHandler creates a ZIP archive (it takes a list of files as its parameter, which are included in the archive)
- WebServiceWorkItemHandler
- TransformWorkItemHandler
- RSSWorkItemHandler
- RESTWorkItemHandler
- JavaInvocationWorkItemHandler
- JabberWorkItemHandler
- JavaHandlerWorkItemHandler
- FTPUploadWorkItemHandler
- ExecWorkItemHandler
- EmailWorkItemHandler
executeWorkItem() and abortWorkItem() methods as defined by the WorkItemHandler interface. These are called during runtime on work item execution.
- Information about the Task are extracted from the WorkItem instance.
- The work item business logic is performed.
- The Process instance is informed that the work item execution finished (completed or aborted) using the respective method of the WorkItemManager:
- for completing execution:
import org.kie.api.runtime.process.WorkItemManager; ... WorkItemManager.completeWorkItem(long workItemId, Map<String, Object> results)
- for aborting execution:
import org.kie.api.runtime.process.WorkItemManager; ... WorkItemManager.abortWorkItem(long workItemId, Map<String, Object> results)
WorkItemHandler.abortWorkItem() before it is completed Section 5.1.4.1, “Asynchronous execution”.
4.14.1.2. Creating a work item definition
- In the Project Explorer panel (the
Project Authoringperspective), select your project. - In the perspective menu, click → .
- In the Create new dialogue box, define the definition details:
- In the Name field provide the definition name.
- Click the button.
- A new tab with the work item definition template opens up in the Work Item editor.
Note
Whenever a user creates a new business process in some project, the default WID will be created. Users will be able to reuse or directly alter the WID file whenever necessary. In addition, there will always be a default WID once the BPMN process is created. - In the editor, edit the source of the MVEL work item definition. The definition is stored in the current package.If you are planning to add the work item using the service repository as opposed to adding the work item handler to the classpath, make sure to define its dependencies, category, etc.If you are creating the definition out of Business Central, your project directory structure should be similar to
PROJECT_NAME/src/main/resources/PACKAGE_NAME/WID_NAME.wid(visible in the Repository view).Example 4.8. Example wid file
import org.drools.core.process.core.datatype.impl.type.StringDataType; import org.drools.core.process.core.datatype.impl.type.ObjectDataType; [ [ "name" : "MyTask", "parameters" : [ "MyFirstParam" : new StringDataType(), "MySecondParam" : new StringDataType(), "MyThirdParam" : new ObjectDataType() ], "results" : [ "Result" : new ObjectDataType("java.util.Map") ], "displayName" : "My Task", "icon" : "" ] ] - Upload and assign an icon to the Work Item:
- Click → .
- In the Create new Uploaded file dialogue box, define the resource name and make sure to include the file's extension in the name. Click the option to locate and upload the file (
pngorgif, 16x16 pixels). Click . - Make sure your mouse is positioned within the blank " " of the icon parameter:
"icon" : " "
Click the Select icon to add drop-down and click the icon file. The icon path will appear within the parameter:"icon" : "ExampleIcon.png"
Note
The path to describe the location of an icon can be relative or absolute, as long as the icon can be found using one of these methods. For example, the following paths are supported:"icon" : "ExampleIcon.png" (icon in the same folder as the .wid file) "icon" : "com/test/ExampleIcon.png" (icon relative to .wid file location) "icon" : "../test/ExampleIcon.png" (icon relative to .wid file location) "icon" : "/HR/src/main/resources/ExampleIcon.png" (absolute path to icon)
- In the Process Designer, check if your work item is available in the palette.
4.14.1.3. Creating a work item handler
- Create a maven project with your implementation of a work item handler with the required business logic. Make sure to call the
completeWorkItem()function to finish the business logic execution and add thekie-apiartifact with the6.x.x.redhat-xversion value as the project dependency.Example 4.9. Notification work item handler
package com.sample; import org.kie.api.runtime.process.WorkItem; import org.kie.api.runtime.process.WorkItemHandler; import org.kie.api.runtime.process.WorkItemManager; public class NotificationWorkItemHandler implements WorkItemHandler { public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { String from = (String) workItem.getParameter("From"); String to = (String) workItem.getParameter("To"); String message = (String) workItem.getParameter("Message"); String priority = (String) workItem.getParameter("Priority"); /* Send email. The ServiceRegistry class is an example class implementing the task business logic. */ EmailService service = ServiceRegistry.getInstance().getEmailService(); service.sendEmail(from, to, "Notification", message); /* Notify manager that work item has been completed. The completeWorkItem() call completes the work item execution. */ manager.completeWorkItem(workItem.getId(), null); } public void abortWorkItem(WorkItem workItem, WorkItemManager manager) { // Do nothing, notifications cannot be aborted } }Important
If theWorkItemManageris not notified about the work item completion, the process engine is never notified that your work item node has completed. - Register the work item handler in the
DEPLOY_DIR/business-central.war/WEB-INF/classes/META-INF/CustomWorkItemHandlers.conffile.TheCustomWorkItemHandlers.conffile contains information like the following:[ "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(), "WebService": new org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler(ksession), "Rest": new org.jbpm.process.workitem.rest.RESTWorkItemHandler() ]
Notice the "Rest" value in the previous file. This indicates theWorkItemHandleris capable of interacting with REST services. It supports both secured/authenticated and open/not authenticated services.This REST value is defined in the project's WID file in the following manner:[ "name" : "Rest", "parameters" : [ //Url - Mandatory resource location to be invoked. "Url" : new StringDataType(), //Method - Defaults to GET and is the HTTP method that will be executed. "Method" : new StringDataType(), //ConnectionTimeout - Defaults to 60 seconds for the connection timeout. "ConnectTimeout" : new StringDataType(), //ReadTimeout - Defaults to 60 seconds for the read timeout. "ReadTimeout" : new StringDataType(), //Username - The username for authentication that overrides the one given on handler initialization. "Username" : new StringDataType(), //Password - The password for authentication that overrides the one given on handler initialization. "Password" : new StringDataType() ], "results" : [ "Result" : new ObjectDataType(), ], "displayName" : "REST", "icon" : "defaultservicenodeicon.png" ]The configuration options displayed about must be given via the work item parameter. The authentication information can be given on handler initialization, but it can be overridden via the work item parameter. - Compile the project. The resulting JAR file should be placed in (
DEPLOY_DIR/business-central.war/WEB-INF/lib/). - Restart the server.
Registering via kmodule.xml
CustomWorkItemHandlers.conf is to configure them with kmodule.xml. This is beneficial in that it avoids a complete server restart.
- Register the work item handler in the menu path
PROJECT_NAME/src/main/resources/META-INF/kmodule.xml - Make sure the work item handler is given as a MVEL expression; for example,
new org.jbpm.wih.CustomHandler()or FQCN expression:org.jbpm.wih.CustomHandler. - Compile the project. Upload the work item handler JAR into Business Central via the Artifact Repository. Then add it as a dependency for the project where the user wants to use this handler.
4.14.1.4. Registering a Work Item handler
WorkItemHandlers are registered in the ksession automatically. However, in order for them to be used in embedded mode, the WorkItemManager registers WorkItemHandler instances. Likewise, in the example below, the NotificationWorkItemHandler needs to be registered in order for it to be used with a process containing a Notification work item:
- Register the work item handler like the following:
/* Create the drools name of the <task> and the custom work item handler instance */ KieSession kieSession = kieBase.newKieSession(); ksession.getWorkItemManager().registerWorkItemHandler( "Notification", new NotificationWorkItemHandler() );
- Look at the BPMN2 syntax for the process. The previous registration example would appear as follows:
<?xml version="1.0" encoding="UTF-8"?> <definitions id="Definition" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" ... xmlns:tns="http://www.jboss.org/drools"> ... <process isExecutable="true" id="myCustomProcess" name="Domain-Specific Process" > ... <!-- The tns:taskName attribute in the <task> node is necessary for the WorkItemManager to be able to see which WorkItemHandler instance should be used with which task or work item. --> <task id="_5" name="Notification Task" tns:taskName="Notification" > ...
Note
4.14.2. Service repository
Important
Note
4.14.2.1. Importing from a service repository
- Open your Process in the Web Process Designer.
- In the editor menu, click the
button.
- In the Service Repository Connection window, define the location of the repository on the location input line and click .

Figure 4.25. Establishing connection to a service repository
- Double-click the asset to import it.
Important
DEPLOY_DIRECTORY/business-central.war/WEB-INF/classes/META-INF/CustomWorkItemHandler.conf file. If a work item is not registered in the file, it will not be available for use.
4.14.2.2. Setting up a service repository
index.conf file in its root directory.
Repository configuration file
index.conf file must be located in the root directory of the service repository. It contains a list of any directory within the repository that are to be considered directories of the service repository.
Example 4.10. index.conf
Email FileSystem ESB FTP Google Java Jabber Rest RSS Transform Twitter
index.conf file so as to serve as a directory or work item resources. Note that the hierarchical structure of the repository is not shown when browsing the repository using the import wizard, as the category property in the configuration file is used for that.
Work items and their resources
- A work item configuration file is a file with the same name as the parent directory (for example,
Twitter.conf) that contains details about the work item resources in the service repository. The file is an extension of the work item definition file (refer to Section 4.14.1, “Work item definition”). Note, that the configuration file must contain references to any dependencies the work item handler requires. Optionally, it can define the documentation property with a path to documentation and category which defines the category the custom work item is placed under in the repository.Example 4.11. Work item configuration file
import org.drools.core.process.core.datatype.impl.type.StringDataType; [ [ "name" : "Twitter", "description" : "Send a twitter message", "parameters" : [ "Message" : new StringDataType() ], "displayName" : "Twitter", "eclipse:customEditor" : "org.drools.eclipse.flow.common.editor.editpart.work.SampleCustomEditor", "icon" : "twitter.gif", "category" : "Communication", "defaultHandler" : "org.jbpm.process.workitem.twitter.TwitterHandler", "documentation" : "index.html", //Every work item definition should specify dependencies even if it doesn't have one. "dependencies" : [] [ "file:./lib/jbpm-twitter.jar", "file:./lib/twitter4j-core-2.2.2.jar" ] ] ] - All resources referenced in the work item configuration file: icon, documentation, and dependencies.
4.14.3. User Task calls
TaskClient class. The API is intended for developers to allow direct managing of the lifecycle of User Tasks. End users are advised to use the Business Central web application for User Task management.
taskId: ID of the target Task instance usually extracted from the currently selected User Task in the user task list in the user interfaceuserId: ID of the user that is executing the action called by the method; usually the ID of the user that is logged in
org.kie.api.task.TaskService class:
void start(long taskId, String userId); void stop(long taskId, String userId); void release(long taskId, String userId); void suspend(long taskId, String userId); void resume(long taskId, String userId); void skip(long taskId, String userId); void delegate(long taskId, String userId, String targetUserId); void complete(long taskId, String userId, Map<String, Object> results);
Example 4.12. Starting and completing a simple user task
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.task.TaskService;
import org.kie.api.task.model.TaskSummary;
....
KieSession ksession = runtimeEngine.getKieSession();
TaskService taskService = runtimeEngine.getTaskService();
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello");
// John is assigned a task and he completes it
List<TaskSummary> list = taskService.getTasksAssignedAsPotentialOwner("john", "en-UK");
TaskSummary task = list.get(0);
logger.info("John is executing task {}", task.getName());
taskService.start(task.getId(), "john");
taskService.complete(task.getId(), "john", null);
...
4.14.4. Actor assignment calls
ActorID or the GroupID parameter, which define the users who can or should execute the User Tasks. It is in the Task List of these users the Task appears.
Example 4.13. Adding user Kris and group Developers on taskSession
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.task");
TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
TaskServiceSession taskSession = taskService.createSession();
// registering new user and group:
taskSession.addUser(new User("Kris"));
taskSession.addGroup(new Group("Developers"));admin roles as well as your custom roles.
Example 4.14. Requesting the list of tasks the user is a potential owner of
List<String> groups = new ArrayList<String>();
groups.add("sales");
taskClient.getTasksAssignedAsPotentialOwner("sales-rep", groups, "en-UK", taskSummaryHandler);Important
Administrator is the administrator of each Task. It is therefore recommended to always define at least user Administrator when registering the list of valid users with the User Task service.
4.14.4.1. Connecting to custom directory information services
- Create an implementation of the UserGroupInfoProducer interface and provide your own custom callback (see Section 4.14.5.1, “Connecting to LDAP”) and user info implementations according to the needs from the producer.This implementation must be annotated with the @Selectable qualifier for it to be found by Business Central. The listing below shows an example LDAP implementation:
import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Alternative; import javax.enterprise.inject.Produces; import org.jbpm.services.task.identity.LDAPUserGroupCallbackImpl; import org.jbpm.services.task.identity.LDAPUserInfoImpl; import org.jbpm.shared.services.cdi.Selectable; import org.kie.api.task.UserGroupCallback; import org.kie.internal.task.api.UserInfo; @ApplicationScoped @Alternative @Selectable public class LDAPUserGroupInfoProducer implements UserGroupInfoProducer { private UserGroupCallback callback = new LDAPUserGroupCallbackImpl(true); private UserInfo userInfo = new LDAPUserInfoImpl(true); @Override @Produces public UserGroupCallback produceCallback() { return callback; } @Override @Produces public UserInfo produceUserInfo() { return userInfo; } } - Package your custom implementations (the
LDAPUserGroupInfoProducer, theLDAPUserGroupCallbackImpland theLDAPUserInfoImplclasses from the example above) into a bean archive (jar with META-INF/beans.xml so it can be found by CDI container). Add this jar file tobusiness-central.war/WEB-INF/lib. - Modify
business-central.war/WEB-INF/beans.xmland add the implementation (LDAPUserGroupInfoProducerfrom the example above) as an alternative to be used by Business Central.<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd"> <alternatives> <class>com.test.services.producer.LDAPUserGroupInfoProducer</class> </alternatives> </beans>Warning
The use of a customUserGroupInfoProducerrequires internal APIs, which may be broken in future releases. Using a customUserGroupInfoProduceris not recommended or supported by Red Hat. - Restart your server and your custom callback implementation should now be used by Business Central.
4.14.5. LDAP connection
- ldap.bind.user: username used to connect to the LDAP server (optional if LDAP server accepts anonymous access)
- ldap.bind.pwd: password used to connect to the LDAP server (optional if LDAP server accepts anonymous access)
- ldap.user.ctx: context in LDAP with user information (mandatory)
- ldap.role.ctx: context in LDAP with group and role information (mandatory)
- ldap.user.roles.ctx: context in LDAP with user group and role membership information (optional; if not specified, ldap.role.ctx is used)
- ldap.user.filter: filter used to search for user information; usually contains substitution keys {0}, which are replaced with parameters (mandatory)
- ldap.role.filter: filter used to search for group and role information, usually contains substitution keys {0}, which are replaced with parameters (mandatory)
- ldap.user.roles.filter: filter used to search for user group and role membership information, usually contains substitution keys {0}, which are replaced with parameters (mandatory)
- ldap.user.attr.id: attribute name of the user ID in LDAP (optional; if not specified,
uidis used) - ldap.roles.attr.id: attribute name of the group and role ID in LDAP (optional; if not specified
cnis used) - ldap.user.id.dn: user ID in a DN, instructs the callback to query for user DN before searching for roles (optional, by default
false) - java.naming.factory.initial: initial conntext factory class name (by default
com.sun.jndi.ldap.LdapCtxFactory) - java.naming.security.authentication: authentication type (possible values are
none,simple,strong; by defaultsimple) - java.naming.security.protocol: security protocol to be used; for instance
ssl - java.naming.provider.url: LDAP url (by default
ldap://localhost:389; if the protocol is set tosslthenldap://localhost:636)
4.14.5.1. Connecting to LDAP
- programatically: build a
Propertiesobject with the respective LDAPUserGroupCallbackImpl properties and createLDAPUserGroupCallbackImplwith thePropertiesobject as its parameter.Example 4.15.
import org.kie.api.PropertiesConfiguration; import org.kie.api.task.UserGroupCallback; ... Properties properties = new Properties(); properties.setProperty(LDAPUserGroupCallbackImpl.USER_CTX, "ou=People,dc=my-domain,dc=com"); properties.setProperty(LDAPUserGroupCallbackImpl.ROLE_CTX, "ou=Roles,dc=my-domain,dc=com"); properties.setProperty(LDAPUserGroupCallbackImpl.USER_ROLES_CTX, "ou=Roles,dc=my-domain,dc=com"); properties.setProperty(LDAPUserGroupCallbackImpl.USER_FILTER, "(uid={0})"); properties.setProperty(LDAPUserGroupCallbackImpl.ROLE_FILTER, "(cn={0})"); properties.setProperty(LDAPUserGroupCallbackImpl.USER_ROLES_FILTER, "(member={0})"); UserGroupCallback ldapUserGroupCallback = new LDAPUserGroupCallbackImpl(properties); UserGroupCallbackManager.getInstance().setCallback(ldapUserGroupCallback); - declaratively: create the
jbpm.usergroup.callback.propertiesfile in the root of your application or specify the file location as a system property:-Djbpm.usergroup.callback.properties=FILE_LOCATION_ON_CLASSPATHMake sure to register the LDAP callback when starting the User Task server.#ldap.bind.user= #ldap.bind.pwd= ldap.user.ctx=ou\=People,dc\=my-domain,dc\=com ldap.role.ctx=ou\=Roles,dc\=my-domain,dc\=com ldap.user.roles.ctx=ou\=Roles,dc\=my-domain,dc\=com ldap.user.filter=(uid\={0}) ldap.role.filter=(cn\={0}) ldap.user.roles.filter=(member\={0}) #ldap.user.attr.id= #ldap.roles.attr.id=
4.15. Exception Management
Business exceptions
- Errors
- An Error is a signal that an unexpected situation occurred (refer to Section A.4.1, “Errors”). The mechanism can be used immediately when the problem arises and does not allow for any compensation.
- Compensation
- Compensation is equivalent to the Error mechanism; however, it can be used only on Sub-Processes when it is required that the execution flow continues after the compensation using the "regular" outgoing Flow (execution continues after the compensation as if no compensation occurred).
- Canceling
- Canceling is equivalent to the Error mechanism; however, it can be used only on Sub-Processes and it is required that the Sub-Process takes the flow leaving the respective Cancel Intermediate Event so that the "normal" execution flow is never taken as opposed to compensation.
Technical exceptions
Chapter 5. Advanced Process modeling
5.1. Process modeling options
- Using one of the graphical editors
- You can use two delivered graphical editors. Process Designer is available through Business Central and Eclipse Process Designer. See Red Hat JBoss BPM Suite User Guide for more information on how to use the editors.
- Using an XML editor
- You can use any XML or text editor to create a process specification using the BPMN2 XML schema.
- Using the Process API
- You can use the JBoss BPM Suite
coreAPI directly. The most important process model elements are defined in the packages org.jbpm.workflow.core and org.jbpm.workflow.core.node.
5.1.1. Process modeling using XML
- XML prolog
- The XML prolog consists of the XML declaration and DTD declaration.
- The
processelement - The
processelement defines process attributes and contains definitions of the process elements (nodes and connections). - BPMN diagram definition
- The
BPMNDiagramelement contains definitions for visualization of the Process elements in the Process Diagram.
Example 5.1. BPMN2 example file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.jboss.org/drools"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"Rule Task
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<process processType="Private" isExecutable="true" id="com.sample.hello" name="Hello Process" >
<!-- nodes -->
<startEvent id="_1" name="Start" />
<scriptTask id="_2" name="Hello" >
<script>System.out.println("Hello World");</script>
</scriptTask>
<endEvent id="_3" name="End" >
<terminateEventDefinition/>
</endEvent>
<!-- connections -->
<sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2" />
<sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="com.sample.hello" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="16" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_2" >
<dc:Bounds x="96" y="16" width="80" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="208" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_2" >
<di:waypoint x="40" y="40" />
<di:waypoint x="136" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_2-_3" >
<di:waypoint x="136" y="40" />
<di:waypoint x="232" y="40" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>5.1.2. Process modeling using API
- Create a Runtime Manager in your Execution Server.
- Singleton: allows sequential execution of multiple instances in the one session
- PerProcessInstance: allows you to create multiple process instances; every instance is created within its own session.
- PerRequestSession: every external interaction with a process instances causes that the process session finishes and the process instance is re-created in a new session.
- Get a runtime context and create a session in it.
- Start a Process from the underlying Knowledge Base.
- Close the Runtime Manager.
Example 5.2. Process instantiation in a session of Per Process Instance Runtime Manager
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.runtime.manager.RuntimeManagerFactory.Factory;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.KieSession;
...
RuntimeManager manager =
RuntimeManagerFactory.Factory.get()
.newPerProcessInstanceRuntimeManager(environment);
RuntimeEngine runtime =
manager.getRuntimeEngine(
ProcessInstanceIdContext.get());
KieSession ksession = runtime.getKieSession();
// do something here, e.g.
ksession.startProcess(“org.jbpm.hello”);
manager.disposeRuntimeEngine(engine);
manager.close();5.1.3. Process update
5.1.3.1. Process update
Abort: any running Process instances are aborted. If necessary, you can have the Process instance restarted using the new Process definition.Transfer: any running Process instances are migrated to the new process definition: once the instance has been migrated successfully, it will continue its execution based on the updated process logic. For further information refer to Section 5.1.3.3, “Migrating a Process instance”.
Example 5.3. Process abort update
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieSessionConfiguration;
// build kbase with the replace-version-1.bpmn process
KieBase kbase = KieServices.Factory.get().newKieSessionConfiguration();
kbase.addKnowledgePackages(getProcessPackages("replace-version-1.bpmn"));
KieSession ksession = kbase.newStatefulKnowledgeSession();
try {
// start a replace-version-1.bpmn process instance
ksession.startProcess("com.sample.process", Collections.<String, Object>singletonMap("name", "process1"));
// add the replace-version-2.bpmn process and start its instance
kbase.addKnowledgePackages(getProcessPackages("replace-version-2.bpmn"));
ksession.startProcess("com.sample.process", Collections.<String, Object>singletonMap("name", "process2"));
// signal all processes in the session to continue (both instances finish)
ksession.signalEvent("continue", null);
} finally {
ksession.dispose();
}5.1.3.2. Process instance migration
5.1.3.3. Migrating a Process instance
Example 5.4. Process transfer with custom active Element mapping
import org.kie.api.KieBase;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.api.runtime.process.WorkflowProcessInstance;
// build kbase with the replace-version-1.bpmn process
KieBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(getProcessPackages("replace-version-1.bpmn"));
KieSession ksession = kbase.newStatefulKnowledgeSession();
try {
// start two instances of the replace-version-1.bpmn process
ProcessInstance pi = ksession.startProcess("com.sample.process", Collections.<String, Object>singletonMap("name", "process1"));
ProcessInstance pi2 = ksession.startProcess("com.sample.process", Collections.<String, Object>singletonMap("name", "process2"));
// add the replace-version-3.bpmn process to the kbase and start its instance
kbase.addKnowledgePackages(getProcessPackages("replace-version-3.bpmn"));
ksession.startProcess("com.sample.process2", Collections.<String, Object>singletonMap("name", "process3"));
// upgrade: active nodes from the replace-version-1.bpmn process are mapped to the same nodes in the process
WorkflowProcessInstanceUpgrader.upgradeProcessInstance(ksession, pi.getId(), "com.sample.process2", null);
// upgrade the process using custom mapping
Map<String, Long> mapping = new HashMap<String, Long>();
mapping.put("3", 8L);
mapping.put("2", 7L);
WorkflowProcessInstanceUpgrader.upgradeProcessInstance(ksession, pi2.getId(), "com.sample.process2", mapping);
ksession.fireAllRules();
// signal all processes they may continue (all of them finish)
ksession.signalEvent("continue", null);
} finally {
ksession.dispose();
}
5.1.4. Multi-threading
5.1.4.1. Asynchronous execution
executeWorkItem() method in the work item handler that allows the Process instance to continue its execution.
Example 5.5. Example of asynchronous service handling in Java
import org.kie.api.runtime.process.WorkItem;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.runtime.process.WorkItemManager;
public class MyServiceTaskHandler implements WorkItemHandler {
public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
new Thread(new Runnable() {
public void run() {
// The main thread with the parent element execution
}
}).start();
}
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
}
}
The Red Hat JBoss BPM Suite Job Executor
Command object.
WorkItemHandler and use the JBoss BPM Suite Job Executor to handle these operations for you.
execute() that accepts the CommandContext data transfer object with serializable data. The Command instance should only contain the business logic to be executed and have no reference to the underlying process engine or runtime related data. At the minimum, the CommandContext should provide the businessKey - the unique identifier of the caller and callback - the fully qualified classname (FQCN) of the CommandCallback instance to be called on command completion. Of course, when executed as part of a process (WorkItemHandler), you will need to provide additional data like the workItem, processInstanceId and deploymentId.
ExecutionResults class. As with the input data, the data provided by this class must also be serializable.
The Asynchronous WorkItemHandler
WorkItemHandler that is backed by the JBoss BPM Suite Job Executor. All the features that the JBoss BPM Suite Executor delivers are available for background execution within a process instance. There are two ways to configure this AsyncWorkItemHandler class:
- As a generic handler where you provide the command name as part of the work item parameters. In Business Central while modeling a process, if you need to execute some work item asynchronously: specify
asyncas the value for the TaskName property, create a data input calledCommandClassand assign the FQCN of thisCommandClassas the data input. - As a specific handler which is created to handle a given type of work item, thus allowing you to register different instances of
AsyncWorkItemHandlerfor different work items. Commands are most likely to be dedicated to a particular work item, which allows you to specify theCommandClassat registration time instead of requiring it at design time, as with the first approach. But this means that an additional CDI bean that implements WorkItemHandlerProducer interface needs to be provided and placed on the application classpath so that the CDI container can find it. When you are ready to model your process, set the value of the TaskName property to the one provided at registration time.
Configuring the JBoss BPM Suite Executor
- org.kie.executor.disabled: true OR false - enable/disable the executor.
- org.kie.executor.pool.size: Integer. Specify the thread pool size for the executor, which by default is 1.
- org.kie.executor.retry.count: Integer. Specifies the default number of retries in case of an error executing a job. The default value is 3.
- org.kie.executor.interval: Integer. Specifies the time to wait between checking for waiting jobs. The default value is 3 seconds.
- org.kie.executor.timeunit: NANOSECONDS OR MICROSECONDS OR MILLISECONDS OR SECONDS OR MINUTES OR HOURS OR DAYS. Specifies the unit for the interval property. The default is SECONDS.
5.1.4.2. Multiple Sessions and persistence
- Thread A has a lock on the ProcessInstanceInfo table, having just committed a change to that table.
- Thread A wants a lock on the SessionInfo table in order to commit a change.
- Thread B has the opposite situation: It has a lock on the SessionInfo table, having just committed a change.
- Thread B wants a lock on the ProcessInstanceInfo table, even though Thread A already has a lock on it.
5.1.5. Technical exceptions
- Code present directly in the process definition
- Code that is not part of the product executed during a Process
- Code that interacts with a technical component outside of the Process Engine
- Code in Element properties, such as the Script property of a
Script Taskelement or in the definitions of the interception actions, that is, theonEntryandonExitproperties - Code in
WorkItemHandlersassociated withtaskand task-type nodes
Code in Element properties
onEntry and onExit properties, Script defined for the Script Task, etc.
scriptTask to interact with a different technical component, such as a database or web service has significant risks because any exceptions thrown will corrupt or abort the Process instance.
task Elements, serviceTask Elements and other task-type Elements. Do not use the scriptTask nodes for these purposes.
Note
scriptTask causes the problem, the Process Engine usually throws the WorkflowRuntimeException with information on the Process (refer to Section 5.1.5.1.5, “Extracting information from WorkflowRuntimeException”).
Code in WorkItemHandlers
handler decorator classes (for examples and detailed information refer to Section 5.1.5.1.2, “Exception handling classes”). These classes include the logic that is executed when an exception is thrown during the execution or abortion of a work item:
- SignallingTaskHandlerDecorator
- catches the exception and signals it to the Process instance using a configurable event type when the
executeWorkItem()orabortWorkItemmethods of the originalWorkItemHandlerinstance throw an exception. The exception thrown is passed as part of the event. This functionality can be also used to signal to an Event SubProcess defined in the Process definition. - LoggingTaskHandlerDecorator
- logs error about any exceptions thrown by the
executeWorkItem()andabortWorkItem()methods. It also saves any exceptions thrown to an internal list so that they can be retrieved later for inspection or further logging. The content and format of the message logged are configurable.
- Does the implementation catch all exceptions the code could return?
- Does the implementation complete or abort the work item after an exception has been caught or uses a mechanisms to retry the process later (in some cases, incomplete process instances might be acceptable)?
- Does the implementation define any other actions that need to be taken when an exception is caught? Would it be beneficial to interact with other technical systems? Should a Sub-Process be triggered to handle the exception?
Important
5.1.5.1. Technical exception examples
5.1.5.1.1. Service Task handlers
- Execution of the Process instance stops: no other parts of the Process are executed.
- The Process instance finishes as ABORTED.

Figure 5.1. Process with an exception handling Event Sub-Process
Parts of the BPMN2 definition of the example Process relevant for exception handling
<itemDefinition id="_stringItem" structureRef="java.lang.String"/><message id="_message" itemRef="_stringItem"/>
<interface id="_serviceInterface" name="org.jbpm.examples.exceptions.service.ExceptionService"> <operation id="_serviceOperation" name="throwException"> <inMessageRef>_message</inMessageRef>
</operation> </interface> <error id="_exception" errorCode="code" structureRef="_exceptionItem"/>
<itemDefinition id="_exceptionItem" structureRef="org.kie.api.runtime.process.WorkItem"/>
<message id="_exceptionMessage" itemRef="_exceptionItem"/>
<interface id="_handlingServiceInterface" name="org.jbpm.examples.exceptions.service.ExceptionService"> <operation id="_handlingServiceOperation" name="handleException"> <inMessageRef>_exceptionMessage</inMessageRef>
</operation> </interface> <process id="ProcessWithExceptionHandlingError" name="Service Process" isExecutable="true" processType="Private"> <!-- properties --> <property id="serviceInputItem" itemSubjectRef="_stringItem"/>
<property id="exceptionInputItem" itemSubjectRef="_exceptionItem"/>
<!-- main process --> <startEvent id="_1" name="Start" /> <serviceTask id="_2" name="Throw Exception" implementation="Other" operationRef="_serviceOperation"> <!-- rest of the serviceTask element and process definition... --> <subProcess id="_X" name="Exception Handler" triggeredByEvent="true" > <startEvent id="_X-1" name="subStart"> <dataOutput id="_X-1_Output" name="event"/> <dataOutputAssociation> <sourceRef>_X-1_Output</sourceRef> <targetRef>exceptionInputItem</targetRef>
</dataOutputAssociation> <errorEventDefinition id="_X-1_ED_1" errorRef="_exception" />
</startEvent> <!-- rest of the subprocess definition... --> </subProcess> </process>
|
The itemDefinition element defines a data structure used in the serviceInputItem property of the Process.
|
|
The message element (1st reference) defines a message that contains the String defined by the itemDefinition element on the line above. The interface element below then refers to the itemDefinition element (2nd reference) in order to define what type of content the service (defined by the interface) expects.
|
|
The error element (1st reference) defines an error that is used to trigger the Event SubProcess of the Process. The content of the error is defined by the itemDefintion element defined below the error element.
|
|
This itemDefinition element (1st reference) defines an item that contains a WorkItem instance. The message element (2nd reference) then defines a message that uses this item definition to define its content. The interface element below that refers to the message definition (3rd reference) in order to define the type of content that the service expects.
In the Process element itself, a property element (4th reference) that contains the initial itemDefinition. This allows the Event SubProcess to store the error it receives in that property (5th reference).
|
5.1.5.1.2. Exception handling classes
serviceTask tasks use the org.jbpm.bpmn2.handler.ServiceTaskHandler class as its task handler class unless the serviceTask defines a custom WorkItemHandler implementation.
SignallingTaskHandlerDecorator instance.
Important
- Error events are signaled by sending an
Error-errorCode attribute valuevalue to the session. - Signal events are signaled by sending the name of the signal to the session.
- If you wanted to send an error event to a Boundary Catch Error Event, the error type should be of the format:
"Error-" + $AttachedNodeID + "-" + $ERROR_CODE. For example,Error-SubProcess_1-888would be a valid error type.However, this is NOT a recommended practice because sending the signal this way bypasses parts of the boundary error event functionality and it relies on internal implementation details that might be changed in the future. For a way to programmatically trigger a boundary error event when an Exception is thrown inWorkItemHandlersee this KnowledgeBase article.
Example 5.6. Using SignallingTaskHandlerDecorator
ServiceTaskHandler calls the ExceptionService.throwException() method to throw an exception (refer to the _handlingServiceInterface interface element in the BPMN2).
SignallingTaskHandlerDecorator that wraps the ServiceTaskHandler sends to the Process instance the error with the set error code.
import java.util.HashMap;
import java.util.Map;
import org.jbpm.bpmn2.handler.ServiceTaskHandler;
import org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator;
import org.jbpm.examples.exceptions.service.ExceptionService;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.internal.builder.KnowledgeBuilder;
import org.kie.internal.builder.KnowledgeBuilderFactory;
import org.kie.internal.io.ResourceFactory;
public class ExceptionHandlingErrorExample {
public static final void main(String[] args) {
runExample();
}
public static ProcessInstance runExample() {
KieSession ksession = createKieSession();
String eventType = "Error-code";
SignallingTaskHandlerDecorator signallingTaskWrapper
= new SignallingTaskHandlerDecorator(ServiceTaskHandler.class, eventType);
signallingTaskWrapper.setWorkItemExceptionParameterName(ExceptionService.exceptionParameterName);
ksession.getWorkItemManager().registerWorkItemHandler("Service Task", signallingTaskWrapper);
Map<String, Object> params = new HashMap<String, Object>();
params.put("serviceInputItem", "Input to Original Service");
ProcessInstance processInstance = ksession.startProcess("ProcessWithExceptionHandlingError", params);
return processInstance;
}
private static KieSession createKieSession() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("exceptions/ExceptionHandlingWithError.bpmn2"), ResourceType.BPMN2);
KieBase kbase = kbuilder.newKnowledgeBase();
return kbase.newKieSession();
}
|
Definition of the Error-code event to be sent to the process instance when the wrapped WorkItemHandler implementation throws an exception
|
|
Construction of the SignallingTaskHandlerDecorator class instance with the WorkItemHandler implementation and eventType as parameters
Note that a SignallingTaskHandlerDecorator class constructor that takes an instance of a WorkItemHandler implementation as its parameter is also available. This constructor is useful if the WorkItemHandler implementation does not allow a no-argument constructor.
|
|
Registering the WorItemHandler with the session
When an exception is thrown by the wrapped WorkItemHandler, the SignallingTaskHandlerDecorator saves it as a parameter in the WorkItem instance with a parameter name configured in the SignallingTaskHandlerDecorator (see the code below for the ExceptionService).
|
5.1.5.1.3. Exception service
ExceptionService class as follows:
<interface id="_handlingServiceInterface" name="org.jbpm.examples.exceptions.service.ExceptionService"> <operation id="_handlingServiceOperation" name="handleException">
ExceptionService class to provide the exception handling abilities. The class is implemented as follows:
import org.kie.api.runtime.process.WorkItem;
...
public class ExceptionService {
public static String exceptionParameterName = "my.exception.parameter.name";
public void handleException(WorkItem workItem) {
System.out.println( "Handling exception caused by work item '" + workItem.getName() + "' (id: " + workItem.getId() + ")");
Map<String, Object> params = workItem.getParameters();
Throwable throwable = (Throwable) params.get(exceptionParameterName);
throwable.printStackTrace();
}
public String throwException(String message) {
throw new RuntimeException("Service failed with input: " + message );
}
public static void setExceptionParameterName(String exceptionParam) {
exceptionParameterName = exceptionParam;
}
}serviceTask.
5.1.5.1.4. Handling errors with Signals
Error event occurs during Process execution and the execution is interrupted immediately: no other Flows or Activities are executed.
Signal event as the Process execution continues after the Signal is processed (that is, after the Signal Event SubProcess or another Activities that the Signal triggered, finish their execution). Also, the Process execution finished successfully, not in an aborted state, which is the case if an Error is used.
error element which is then used to throw the Error:
<error id="_exception" errorCode="code" structureRef="_exceptionItem"/>
- Remove the line defining the
errorelement and define a<signal>element:<signal id="exception-signal" structureRef="_exceptionItem"/>
- Make sure to change all references from the "
_exception"<error>to the "exception-signal"<signal>.Change the<errorEventDefinition>element in the<startEvent>,<errorEventDefinition id="_X-1_ED_1" errorRef="_exception" />
to a<signalEventDefinition>:<signalEventDefinition id="_X-1_ED_1" signalRef="exception-signal"/>
5.1.5.1.5. Extracting information from WorkflowRuntimeException
scriptTask element that causes an exception, you can extract the information from the WorkflowRuntimeException as it is the wrapper of the scriptTask.
WorkflowRuntimeException instance stores the information outlined in Table 5.1, “Information in WorkflowRuntimeException instances”. Values of all fields listed can be obtained using the standard get* methods.
Table 5.1. Information in WorkflowRuntimeException instances
| Field name | Type | Description |
|---|---|---|
processInstanceId | long |
The id of the
ProcessInstance instance in which the exception occurred
Note that the
ProcessInstance may not exist anymore or be available in the database if using persistence.
|
processId | String | The id of the process definition that was used to start the process (that is, "ExceptionScriptTask" in
ksession.startProcess("ExceptionScriptTask");
) |
nodeId | long | The value of the (BPMN2) id attribute of the node that threw the exception |
nodeName | String | The value of the (BPMN2) name attribute of the node that threw the exception |
variables | Map<String, Object> | The map containing the variables in the process instance (experimental) |
message | String | The short message with information on the exception |
cause | Throwable | The original exception that was thrown |
WorkflowRuntimeException exception instance.
import org.jbpm.workflow.instance.WorkflowRuntimeException;
import org.kie.api.KieBase;
import org.kie.api.io.ResourceType;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.internal.builder.KnowledgeBuilder;
import org.kie.internal.builder.KnowledgeBuilderFactory;
import org.kie.internal.io.ResourceFactory;
public class ScriptTaskExceptionExample {
public static final void main(String[] args) {
runExample();
}
public static void runExample() {
KieSession ksession = createKieSession();
Map<String, Object> params = new HashMap<String, Object>();
String varName = "var1";
params.put( varName , "valueOne" );
try {
ProcessInstance processInstance = ksession.startProcess("ExceptionScriptTask", params);
} catch( WorkflowRuntimeException wfre ) {
String msg = "An exception happened in "
+ "process instance [" + wfre.getProcessInstanceId()
+ "] of process [" + wfre.getProcessId()
+ "] in node [id: " + wfre.getNodeId()
+ ", name: " + wfre.getNodeName()
+ "] and variable " + varName + " had the value [" + wfre.getVariables().get(varName)
+ "]";
System.out.println(msg);
}
}
private static KieSession createKieSession() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("exceptions/ScriptTaskException.bpmn2"), ResourceType.BPMN2);
KieBase kbase = kbuilder.newKnowledgeBase();
return kbase.newKieSession();
}
}5.2. Workflow patterns
$JBOSS_HOME/standalone/deployments/business-central.war/org.kie.workbench.KIEWebapp/defaults/patterns.json file.
5.2.1. Defining workflow patterns
- In the stencil set of the Process Designer, locate the workflow pattern that resembles most to and that will use as base for your workflow pattern.
- Open the
$JBOSS_HOME/standalone/deployments/business-central.war/org.kie.workbench.KIEWebapp/defaults /patterns.jsonfile in a text editor. - Locate the JSON object with the description property set to the base workflow pattern name (for example,
"description" : "Sequence Pattern"). - Copy the JSON object and modify its elements as needed. Note that all the JSON objects are nested in a pair of square brackets and are comma separated.
Chapter 6. Social Events
Follow User
Activity Timeline
Part II. Simulation and testing
Chapter 7. Process simulation
7.1. Path Finder
) button and click Process Paths.
Note

Figure 7.1. Process Paths
7.2. Simulating a Process
7.2.1. Defining Simulation details on Elements
7.2.2. Running a Simulation
- Open the Process in the Process Designer and make sure you have defined the simulation parameters for individual Elements.

Figure 7.2. Simulation Properties
- Click the (
) icon in the toolbar and then click the Run Simulation entry.
- In the Run Process Simulation dialog window, define the simulation session details:

Figure 7.3. Run Process Simulation properties dialog window
- Number of instance: number of Process instances to be created and triggered
- Interval: interval between individual Process instantiations
- Interval units: time of unit the Interval is defined in
- Click .
7.2.3. Examining Simulation results
- The Process section with general Process simulation graphs
- The Activities section with individual Activities' simulation graphsActivities graphs for Human Tasks include Execution Time with the Max, Min, and Average execution time for the given Activity, Resource Utilization for the hours a resource has been used, and the Cost Parameters graph if applicable (if you defined the Cost parameter for the Activity). For Script Tasks only the Execution Time with the Max, Min, and Avarage execution time, is available.
- The Paths section with simulation graph of the Paths taken during the simulation.The graphs contain the Process model with the respective Path highlighted and execution statistics on the Path.
Graph types

Figure 7.4. Simulation Graph types
Filters

Figure 7.5. Graph item radiobutton
Timeline
in the upper right corner of the respective graph: The timeline depicting individual events is displayed in the lower part of the canvas. Click the arrows on the right and left from the chart to move through the timeline. The data current for the particular moment are applied to the chart depicted above instantly.

Figure 7.6. Process Simulation Timeline

Figure 7.7. Line Chart
Chapter 8. Testing
8.1. Unit testing
- helper methods to create a new kie base and session for given processes (Also, you can select if persistence is to be used.)
- assert statements to check among other also the following:
- the state of a process instance (active, completed, aborted)
- which node instances are currently active
- which nodes have been triggered to check the path that has been followed
- the value of variables
Example 8.1. JUnit test of the com.sample.bpmn.hello Process
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.process.ProcessInstance;
public class MyProcessTest extends org.jbpm.test.JbpmJUnitBaseTestCase {
public void testProcess() {
// create singleton runtime manager and load the given process(es)
createRuntimeManager("sample.bpmn");
// get the single kie session
RuntimeEngine engine = getRuntimeEngine();
KieSession ksession = engine.getKieSession();
// start the process
ProcessInstance processInstance =
ksession.startProcess("com.sample.bpmn.hello");
// check whether the process instance has completed successfully
assertProcessInstanceCompleted(processInstance.getId(), ksession);
// check whether the given nodes were executed during the process execution
assertNodeTriggered(processInstance.getId(), "StartProcess", "Hello", "EndProcess");
}
}8.2. Session creation
createRuntimeManager(String... process)creates default configuration of the RuntimeManager with singleton strategy and all processes added to the kie base. There will only be one RuntimeManager created during single test and the processes shall be added to the kie base.createRuntimeManager(Strategy strategy, String identifier, String... process)creates default configuration of RuntimeManager with given strategy and all processes being added to the kie base.Strategyselects the strategies that are supported, andidentifieridentifies the RuntimeManager.createRuntimeManager(Map<String, ResourceType> resources)creates default configuration of RuntimeManager with singleton strategy and all resources being added to kie base. Theresourcescode identifies the processes, rules, etc that shall be added to the kie base.createRuntimeManager(Map<String, ResourceType> resources, String identifier)creates default configuration of RuntimeManager with singleton strategy and all resources added to kie base. Like the method above but with anidentifierthat identifies the RuntimeManager.createRuntimeManager(Strategy strategy, Map<String, ResourceType> resources)creates default configuration of RuntimeManager with given strategy and all resources being added to the kie base. There will be only one RuntimeManager created during single test. Thestrategycode is the selected strategy of those that are supported. Theresourcescode are all the resources that shall be added to the kie base.createRuntimeManager(Strategy strategy, Map<String, ResourceType> resources, String identifier)creates default configuration of RuntimeManager with given strategy and all resources being added to kie base. There will be only one RuntimeManager created during single test. Thestrategycode selects the supported strategies. Theresourcescode identifies the resources that shall be added to the kie base. Theidentifiercode identifies the RuntimeManger.createRuntimeManager(Strategy strategy, Map<String, ResourceType< resources, RuntimeEnvironment environment, String identifier)is the lowest level of creation of RuntimeManager that expects to get RuntimeEnvironment to be given as an argument. It does not assume any particular configuration; that is, it allows you to configure every single piece of RuntimeManager manually. Thestrategycode selects the strategies of those that are supported. Theresourcescode identifies the resources added to the kie base. Theenvironmentcode is the runtime environment used for RuntimeManager creation. Theidentifiercode identifies the RuntimeManager.
getRuntimeEngine()returns a new RuntimeEngline built from the manager of the test case. It uses EmptyContext that is suitable for the following strategies: singleton and request.getRuntimeEngine(Context<?> context)returns a new RuntimeEngine built from the manager of the test case. Common use case would be to maintain the same session for the process instance and thus a ProcessInstanceIdContext shall be used. Thecontextcode is the instance of the context that shall be used to create RuntimeManager.
8.2.1. Assertions
- assertProcessInstanceActive(long processInstanceId, KieSession ksession): checks whether the Process instance with the given id is active.
- assertProcessInstanceCompleted(long processInstanceId, KieSession ksession): checks whether the Process instance with the given id has completed. successfully
- assertProcessInstanceAborted(long processInstanceId, KieSession ksession): checks whether the Process instance with the given id was aborted.
- assertNodeActive(long processInstanceId, KieSession ksession, String... name): checks whether the process instance with the given id contains at least one active node with the given node names.
- assertNodeTriggered(long processInstanceId, String... nodeNames): checks for each given node name whether a node instance was triggered during the execution of the Process instance.
- getVariableValue(String name, long processInstanceId, KieSession ksession): retrieves the value of the variable with the given name from the given Process instance.
8.2.2. Integration with external services
Example 8.2. Testing an Email Task
import org.kie.api.runtime.manager.RuntimeManager;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.KieSesssion;
import org.kie.api.runtime.process.WorkItem;
import org.kie.api.runtime.process.WorkItemHandler;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie,api.runtime.process.WorkItemManger;
public void testProcess2() {
// create runtime manager with single process - hello.bpmn
createRuntimeManager("sample-process.bpmn");
// take RuntimeManager to work with process engine
RuntimeEngine runtimeEngine = getRuntimeEngine();
// get access to KieSession instance
KieSession ksession = runtimeEngine.getKieSession();
// register a test handler for "Email"
TestWorkItemHandler testHandler = getTestWorkItemHandler();
ksession.getWorkItemManager().registerWorkItemHandler("Email", testHandler);
// start the process
ProcessInstance processInstance = ksession.startProcess("com.sample.bpmn.hello2");
assertProcessInstanceActive(processInstance.getId(), ksession);
assertNodeTriggered(processInstance.getId(), "StartProcess", "Email");
// check whether the email has been requested
WorkItem workItem = testHandler.getWorkItem();
assertNotNull(workItem);
assertEquals("Email", workItem.getName());
assertEquals("me@mail.com", workItem.getParameter("From"));
assertEquals("you@mail.com", workItem.getParameter("To"));
// notify the engine the email has been sent
ksession.getWorkItemManager().abortWorkItem(workItem.getId());
assertProcessInstanceAborted(processInstance.getId(), ksession);
assertNodeTriggered(processInstance.getId(), "Gateway", "Failed", "Error");
}
The test case uses a test handler that registers when an email is requested and allows you to test the data related to the email. Once the engine has been notified the email could not be sent by the abortWorkItem(..) method call, the unit test verifies that the Process handles this case by logging the fact and terminating with an error.

Figure 8.1. Process with a custom Email Service Task
8.2.3. Persistence
JbpmJUnitBaseTestCase in the jbpm-test module that greatly simplifies your junit testing. This helper class provides methods to create a new RuntimeManager and RuntimeEngine for a given process or set of processes. By default, persistence is not used, and it is controlled by the super constructor. The helper method allows you to select whether or not you wish to use persistence. The example below shows a helper class to allow persistence:
Example 8.3.
public class ProcessHumanTaskTest extends JbpmJUnitBaseTestCase {
public ProcessPersistenceTest() {
// setup data source, enable persistence
super(true, true);
}
....Part III. Plug-in
Chapter 9. Plug-in
9.1. Creating BPM project
- On the main menu of JBoss Developer Studio, click → → and then → → .
- Then choose → .
- In the New jBPM Project dialog, define the project name and location and click .
- Select the required content of the project and click .
- Select the runtime to be used by the project or click and define a new runtime (for details on runtime resources, refer to the Red Hat JBoss BPM Suite Installation Guide).
- Select the required compatibility mode and click .
Note
- Click → (Maven)
9.2. Creating Process
- Choose → →
- Select → .
- In the displayed dialog box, define the location and the filename of the Process. Make sure you follow maven structure requirements.
Note
- Select → .
9.3. Using the Debug Perspective
Procedure 9.1. The Debug Perspective
- Open the Process Instance view
- Select under the category
- Use a Java breakpoint to stop your application at a specific point (for example, after starting a new process instance).
- In the Debug perspective, select the ksession you would like to inspect.
- The Process Instances view will show the process instances that are currently active inside that ksession.
- When double-clicking a process instance, the process instance viewer will graphically show the progress of that process instance.
- Sometimes, when double-clicking a process instance, the process instance viewer complains that is cannot find the process. This means that the plug-in was not able to find the process definition of the selected process instance in the cache of parsed process definitions. To solve this, simply change the process definition in question and save again.

Figure 9.1. Process Instance in the Debugger
Note
9.4. Checking session logs
Procedure 9.2. Creating a logger
- To create a logger, use KieServices as depicted below:
KieRuntimeLogger logger = KieServices.Factory.get().getLoggers() .newThreadedFileLogger(ksession, "mylogfile", 1000); // do something with the ksession here logger.close();
- Attach the new logger to a ksession.
- Be sure to close the logger after usage.
Procedure 9.3. Using Audit View
- To use Audit View, open
- Under the category, select .
- To open a log file in Audit View, select the log file using the action in the top right corner, or simply drag and drop the log file from the Package Explorer or Navigator into the Audit View.
- A tree-based view is generated based on the data inside the audit log. Depicted below is an example tree-based view:

Figure 9.2. Tree-Based View
- An event is shown as a subnode of another event if the child event is caused by a direct consequence of the parent event.
Note
Part IV. Deployment and runtime management
Chapter 10. Deploying projects
- Open the
Project Editoron your project (in Project Explorer navigate to your project and in the top menu, click → ). - You can define the Kie Base and Kie Session properties. If not, the default kbase and ksession will be used.
- On the top menu, click the
button.
Note
10.1. Process instances
10.1.1. Instantiating a Process
- Display the
Process Definitionsview: on the top menu, click → . - Look up the Process Definition and in the respective row, click the Instantiate
icon
.
- In the displayed dialog view, enter the properties and input paramaters for the Process instance.
10.1.2. Monitoring a Process instance
- On the top menu of the Business Central, go to → .
- In the list on the Process Instances tab, locate the required running Process instance and click the
button in the instance row.
10.1.3. Aborting a Process instance
Aborting a Process instance using API
void abortProcessInstance(long processInstanceId) call on the parent Kie Session.
Aborting a Process instance from the Management Console
- On the top menu of the Management Console, go to → .
- In the list on the Process Instances tab, locate the required Process instance and click the
button in the instance row.
10.2. User tasks
Task client
in the view toolbar.
button. To undo the claim process, click the button again.
: the panel contains the Work, Assignments, Details, and Comments button: On the Comments button, you can review comments provided by other users on the Task and add your own comments. To work on the Task, open the Work tab: the respective Form defined for the Task appears (if the current user hasn't been assigned the task, a form to claim the task appears first)). If no Form for the Task is defined a default Form is generated based on the jbpm-playground.git/globals/forms/DefaultTask.ftl file and on the input and output data of the Task.
10.2.1. Creating user task
- Open the Tasks drop down menu ( → ).
- On the Tasks List tab, click and define the task parameters:
- Task Name: the task display name
- Advanced
- Due Date
- User: user name of the person to execute the task
- Priority: priority level
- A Task cannot be created without a
Useror aGroup. To add more users, select the Add User
button.
- To add more groups, select the Add Group
button.
- Click the Create button when you are satisfied with the information provided.
Chapter 11. Logging
Chapter 12. Examples
Part V. BAM
Chapter 13. Red Hat JBoss Dashboard Builder
What is Business Activity Monitoring?
13.1. Accessing Dashboard Builder
- displays a pre-defined dashboard based on runtime data from the Execution Server. In the menu on the left, select the entity you are interested. The widgets on the right will display the data for the entity.
- Using the URL https://HOSTNAME/dashbuilder (with the appropriate Hostname).
- Using business-central with > menus.
- displays the environment in which you can create your own dashboards. Procedures on how to create a custom dashboard are provided below.
13.2. Basic concepts
13.3. Environment
Procedure 13.1. To access Dashbuilder through business-central
- Log into business-central with your user account.
- Select > .
- Dashbuilder will open in a new browser / window tab.
Procedure 13.2. To access Dashbuilder through web browser.
- Go to Dashbuilder directly through https://HOSTNAME/dashbuilder
- An example instance running the local host would be https://localhost:8080/dashbuilder
13.4. Data sources
13.4.1. Connecting to data sources
- Make sure the data source is up and running and that the application server has access to the data source. (Check the driver, the login credentials, etc. In Red Hat JBoss EAP 6, you can do so in the Management Console under → → )
- In Dashboard Builder, on the Tree Menu (by default located on the of the Showcase perspective), go to → .
- On the displayed External Connection panel, click the
button.
- Select the data source type (JNDI or Custom DataSource) and provide the respective data source parameters below.
13.4.2. Security considerations
Important
13.4.3. Building a Dashboard for Large Volumes of Data
- The in-memory strategyThe in-memory strategy is to create a data provider that loads all the required data from the database by executing a single SQL query on the relevant tables, into the Dashboard Builder's memory. In this case, every indicator on the Dashboard Builder shares the same data set. When you use filters from the Dashboard Builder user interface to access specific data from this data set, the Dashboard Builder fetches the data from the internal memory and does not execute another SQL query again on the database. This strategy has a simple data retrieval logic as it deals with creating a single data provider. As all the data set properties are available to you at once, it allows you to configure KPIs faster. However, this approach is not suitable for large data sets as it would lead to poor performance.
- The native strategyThe native approach is to create a data provider for every indicator in the Dashboard Builder and does not require loading all the data into the internal memory at once. So each time you use a filter from the Dashboard Builder user interface, the corresponding SQL queries get executed and fetches the required data from the database. So there is no data in the Dashboard Builder's internal memory. This strategy works best in case of large volumes of data, however it needs proper indexing on the database tables. Also, setting up data providers for multiple KPIs is complicated as compared to creating a single data provider in case of in-memory strategy.
Let us consider a case when you want to create a stock exchange dashboard comprising the following charts and reports:
- Bar chart for Average price per company
- Area chart for Sales price evolution
- Pie chart for Companies per country
- Table report for Stock prices at closing date
- Company: Comprising columns ID, NAME, and COUNTRY.
- Stock: Comprising columns ID, ID_COMPANY, PRICE_PER_SHARE, and CLOSING_DATE.
SELECT C.NAME, C.COUNTRY, S.PRICE_PER_SHARE, S.CLOSING_DATE FROM COMPANY C JOIN STOCK S ON (C.ID=S.ID_COMPANY)The output of this query is saved in the Dashboard Builder's local memory. The Dashboard accesses this data every time a filter is run.
- For the bar chart on Average price per company, the following SQL query is executed:
SELECT C.NAME, AVG(S.PRICE_PER_SHARE) FROM COMPANY C JOIN STOCK S ON (C.ID=S.ID_COMPANY) WHERE {sql_condition, optional, c.country, country} AND {sql_condition, optional, c.name, name} GROUP BY C.NAME - For the area chart on Sales price evolution, the following SQL query is executed:
SELECT S.CLOSING_DATE, AVG(S.PRICE_PER_SHARE) FROM COMPANY C JOIN STOCK S ON (C.ID=S.ID_COMPANY) WHERE {sql_condition, optional, c.country, country} AND {sql_condition, optional, c.name, name} GROUP BY CLOSING_DATE - For the pie chart on Companies per country, the following SQL query is executed:
SELECT COUNTRY, COUNT(ID) FROM COMPANY WHERE {sql_condition, optional, country, country} AND {sql_condition, optional, name, name} GROUP BY COUNTRY - For the table report on Stock prices at closing date, the following SQL query is executed:
SELECT C.NAME, C.COUNTRY, S.PRICE_PER_SHARE, S.CLOSING_DATE FROM COMPANY C JOIN STOCK S ON (C.ID=S.ID_COMPANY) WHERE {sql_condition, optional, c.country, country} AND {sql_condition, optional, c.name, name}
{sql_condition} clauses. The signature of the {sql_condition} clause is the following:
{sql_condition, [optional | required], [db column], [filter property]}
Here,
- optional: This indicates that if there is no filter for the given property, then the condition is ignored.
- required: This indicates that if there is no filter for the given property, then the SQL returns no data.
- db column: This indicates the database column where the current filter is applied.
- filter property: This indicates the selected UI filter property.
13.4.4. Data providers
13.4.4.1. Creating data providers
- In the Tree Menu (the panel in the lateral menu of the Showcase workspace), click → .
- In the Data Providers panel, click the
button.
- In the updated Data Providers panel, select in the Type dropdown menu the type of the data provider depending on the source you want the data provider to operate on.
- Define the data provider parameters:
- Data provider over a CSV file
- Name: user-friendly name and its locale
- CSV file URL: the url of the file (for example,
file:///home/me/example.csv) - Data separator: the symbol used as separator in the CSV file (the default value is semicolon; if using comma as the separator sign, make sure to adapt the number format if applicable)
- Quoting symbol: the symbol used for quotes (the default value is the double-quotes symbol; note that the symbol may vary depending on the locale)
- Escaping symbol: the symbol used for escaping the following symbol in order to keep its literal value
- Date format: date and time format
- Number format: the format of numbers as resolved to thousands and decimals
- Data provider over a database (SQL query)
- Name: user-friendly name and its locale
- Data source: the data source to query (the default value is
local, which allows you to query the Dashboard Builder database) - Query: query that returns the required data
- Click
to verify the parameters are correct.
- Click .
- In the table with the detected data, define the data type and if necessary provide a user-friendly name for the data. Click .
13.4.5. Workspace
) in the top menu on the left. You can also edit the current workspace properties, delete the current workspace, and duplicate the current workspace using icons in the top panel.
13.4.5.1. Creating a workspace
- Click the button on the top menu.The management console with the Workspace node expanded and workspace management area with workspace details on the right is displayed.
- In the Create workspace table on the right, set the workspace parameters:
- Name: workspace name and its locale
- Title: workspace title and its locale
- Skin: skin to be applied on the workspace resources
- Envelope: envelope to be applied on the workspace resources
- Click .
- Optionally, click the workspace name in the tree menu on the left and in the area with workspace properties on the right define additional workspace parameters:
- URL: the workspace URL
- User home search: the home page settingIf set to
Role assigned page, the home page as as in the page permissions is applied; that is, every role can have a different page displayed as its home page. If set toCurrent page, all users will use the current home page as their home page.
13.4.5.2. Pages
13.4.5.2.1. Creating Pages
- Make sure you are in the correct workspace.
- Next to the Page dropdown box
in the top menu, click the
button
.
- The management console with the Pages node expanded and page management area with page details on the right is displayed.
- In the Create new page table on the right, set the page parameters:
- Name: page name and its locale
- Parent page: parent page of the new page
- Skin: skin to be applied on the page
- Envelope: envelope to be applied on the page
- Page layout: layout of the page
- Click .
- Optionally, click the page name in the tree menu on the left and in the area with workspace properties on the right define additional page parameters:
- URL: the page URL
- Visible page: visibility of the page
- Spacing between regions and panels
13.4.5.2.2. Defining Page permissions
other security domain by default), the Red Hat JBoss Dashboard Builder has its own role-based access control (RBAC) management tool to facilitate permission management on an individual page or multiple pages.
- On the top menu, click the
button
: the management console is displayed.
- Under the Workspace node on the left, locate the page or the Pages node.
- Under the page/pages node, click the Page permissions node.
- In the Page permissions area on the right, delete previously defined permission definition if applicable and define the rights for the required role:
- In the Permission assignation table, locate the Select role dropdown menu and pick the respective role.
- In the Actions column of the table, enable or disable individual permissions.
- Click .
13.4.5.3. Panels
- Dashboard panels
- are the primary BAM panels and include the following:
- Data provider manager: a panel with a list of available data providers and data provider management options
- Filter and Drill-down: a panel that displays all KPIs and their values to facilitate filtering in indicators on the given page defined over a data provider
- HTML Editor panel: a panel with static content
- Key Performance Indicator (indicator): a panel that visualizes the data of a data provider
- Navigation panels
- are panels that provide navigation functions and include the following:
- Breadcrumb: a panel with the full page hierarchy pointing to the current page
- Language menu: a panel with available locales (by default in the top center)
- Logout panel: a panel with the name of the currently logged-in user and the logout button
- Page menu custom: a panel with vertically arranged links to all pages in the workspace (the list of pages can be adjusted) and general controls for the HTML source of the page
- Page menu vertical: a panel with vertically arranged links to all pages in the workspace (the list of pages can be adjusted)
- Page menu horizontal: a panel with horizontally arranged links to all pages in the workspace (the list of pages can be adjusted)
- Tree menu: a panel with the links to essential features such as Administration, Home (on the Home page of the Showcase workspace displayed on the left, in the lateral menu)
- Workspace menu custom: a panel with links to available workspaces (the list of workspaces can be adjusted) and general controls for the HTML source of the workspace
- Workspace menu horizontal: a horizontal panel with links to available workspaces (the list of workspaces can be adjusted)
- Workspace menu vertical: a vertical panel with links to available workspaces (the list of workspaces can be adjusted)
- System panels
- are panels that provide access to system setting and administration facilities and include the following:
- Data source manager: a panel for management of external data sources
- Export dashboards: a panel export of dashboards
- Export/Import workspaces: a panel for exporting and importing of workspaces
13.4.5.3.1. Adding panels
- Make sure the respective page is open (in the Page dropdown menu of the top menu select the page).
- In the top menu, click the
button.
- In the displayed dialog box, expand the panel type you want to add (Dashboard, Navigation, or System) and click the panel you wish to add.
- From the Components menu on the left, drag and drop the name of an existing panel instance or the Create panel item into the required location on the page.If inserting a new indicator, the Panel view with the graph settings will appear. Define the graph details and close the dialog.If adding an instance of an already existing indicator, you might not be able to use it, if it is linked to the KPIs on the particular original page. In such a case, create a new panel.
- If applicable, edit the content of the newly added panel.
Chapter 14. Management console
- Workspaces tree with individual workspaces and their pages (general item settings are displayed on the right)
- Graphic resources tree with options for upload of new graphic resources and management of the existing ones
- General permissions with access roles definitions and access permission management
button in the upper left corner.
Chapter 15. Graphic resources
- Skins define a set of style sheets, images, and icons
- Region layouts define layouts of regions for pages
- Envelopes define an HTML template used as page frames
Graphic resources definitions
$DEPLOYMENT_LOCATION/dashbuilder.war/WEB-INF/etc/ directory.
- properties file that defines the name of the component for individual supported locales, the name of the css file to be applied on the component, and mapping of file to individual component elements
- JSP, HTML, CSS files, and image and icon resources referenced from the properties file
15.1. Working with graphic resources
- On the top menu, click the button .
- Under the Graphic resources node on the left, click the component type you want to work with (Skins, Layouts, Envelopers). The window on the right will display the content relevant for the given component type.
- On the right, you can now do the following:
- Upload a new component: you need to provide a unique ID for the component and the resource zip file. Then click .
- Download a component definition or preview the component: in the table below the Add view, click the respective icon in the Actions column.
Appendix A. Process Elements
A.1. Process
Runtime
kcontext, holds all the Process runtime data. You can call it in your code, for example, in Action scripts, to obtain or modify the runtime data:
- Getting the currently executed Element instance so as to query further Element data, such as its name and type, or cancel the Element instance.
Example A.1. Getting the currently executed Element
NodeInstance element = kcontext.getNodeInstance(); String name = element.getNodeName();
- Getting the currently executed Process instance so as to query further Process instance data, such as, its name, ID, or abort or send an event, such as a Signal.
Example A.2. Getting the currently executed Process and sending it a Signal event
ProcessInstance proc = kcontext.getProcessInstance(); proc.signalEvent( type, eventObject );
- Getting and setting the values of variables
- Execute calls on the Knowledge runtime, for example, start Process instances, insert data, etc.
- The
createProcessInstancemethod is called on a Process: a new process instance based on a Process is created and Process variables are initialized . The process instance is in statusCREATED. - The
start()method is called on the ProcessInstance: the execution of the Process instance is triggered (the token on the Start Event is generated). If the Process was instantiated manually, the token is generated only on its None Start Event. If it is instantiated using another mechanism, such as Signal, Message, or Error, the token is generated on the Start Event of the respective type that is defined to handle the particular object. The process instance becomesACTIVE. - Once there is no token in the flow (tokens are consumed by End Events and destroyed by Terminating Events), the Process instance is finished and becomes
CANCELLED.
Properties
- ID
- Process ID defined as a String unique in the parent Knowledge BaseExample value:
org.jboss.exampleProcessIt is recommended to use the ID form<packageName>.<processName>.<version>. - Name
- Process display name
- Version
- Process version
- Package
- Parent package the Process belongs to (Process namespace)Possible values:
true,false - Target Namespace
- BPMN2 xsd location
- Executable
- type of the process as concerns its executabilityPossible values:
true,false - Imports
- Imported Process
- Documentation
- Documentation is a generic element attribute that can contain element description. It has no impact on runtime.
- AdHoc
- Boolean property defining whether a Process is an Ad-hoc Process:If set to
true, the flow of the Process execution is controlled exclusively by a human user. - Executable
- Boolean property defining whether a Process is intended for execution or not (if set to
false, the process cannot be instantiated) - Globals
- Set of global variables visible for other Processes to allow sharing of data between them
A.2. Events mechanism
- Internal event: Any action inside a process (for example, the action of an action node, or an on-entry or on-exit action of some node) can signal the occurrence of an internal event to the surrounding Process instance.
Example A.3. Schema of the call sending an event to the Process instance
kcontext.getProcessInstance().signalEvent(type, eventData);
- External event: A process instance can be notified of an event from outside
Example A.4. Schema of the call notifying a Process instance about an external event
processInstance.signalEvent(type, eventData);
- External event using event correlation: Instead of notifying a Process instance directly, you can notify the entire Session and let the engine determine which Process instances might be interested in the event using event correlation. Event correlation is determined based on the event type. A Process instance that contains an Event element listening to external events of some type is notified whenever such an event occurs. To signal such an event to the process engine, write code such as:
Example A.5. Schema of the call notifying a Session about an external event
ksession.signalEvent(type, eventData);
A.3. Collaboration mechanisms
- Messages: Messages are used to communicate within the process and between process instances. Messages are implemented as signals which makes them scoped only for a given
KSessioninstance.For external system interaction send and receive task should be used with proper handler implementation. - Escalations: mainly inter-process (between processes) signalling of escalation to trigger escalation handling
- Errors: mainly inter-process signalling of escalation to trigger escalation handling
- Signals: general, mainly inter-process instance communication
A.3.1. Messages
Attributes
Mandatory Attributes
- Message
- string with the message
A.3.2. Escalation
"An Escalation identifies a business situation that a Process might need to react to." [2]
Attributes
Mandatory Attributes
- Escalation Code
- string with the escalation code
A.3.3. Signals
Note
- To instantiate a Process instance directly with a Signal, you can use the following API function:
ksession.signalEvent(eventType, data, processInstanceId)
The eventType parameter defines the Signal's Event Type, the data parameter defines the data accompanying the Signal, and processInstanceId defines the ID of the Process to be instantiated. - To trigger a Signal from a script, that is, from a Script Task or using on-entry or on-exit actions of a node, you can use the following API function:
kcontext.getKieRuntime().signalEvent( eventType, data, kcontext.getProcessInstance().getId());
A.4. Transaction mechanisms
A.4.1. Errors
Attributes
- Error Code
- Error Code defined as a String unique within the Process.
A.4.2. Compensation
Note
- When an interaction with an external party or 3rd party system may fail or be faulty
- When you can not fully check the input data received by your Process (for example, a client's address information)
- When there are parts of your Process that are particularly dependent on one of the following:
- Company policy or policy governing certain in-house procedures
- Laws governing the business process (such as, age requirements)
A.5. Timing
Note
- Time Duration
- defines the period for which the execution of the event is put on hold. The execution continues after the defined period has elapsed. The timer is applied only once.
- Time Cycle
- This defines the time between subsequent timer activations. If the period is
0, the timer is triggered only once.
- Cron
- [#d][#h][#m][#s][#[ms]]
Example A.6. Timer period with literal values
1d 2h 3m 4s 5ms
The element will be executed after 1 day, 2 hours, 3 minutes, 4 seconds, and 5 milliseconds.Any validISO8601date format that supports both one shot timers and repeatable timers can be used. Timers can be defined as date and time representation, time duration or repeating intervals. For example:- Date
- 2013-12-24T20:00:00.000+02:00 - fires exactly at Christmas Eve at 8PM
- Duration
- PT2S - fires 1 after 2 seconds
- Repetable Intervals
- R/PT1S - fires every second, no limit, alternatively R5/PT1S will fire 5 times every second
- None
- #{expression}
Example A.7. Timer period with expression
myVariable.getValue()
The element will be executed after time period returned by the callmyVariable.getValue().
A.6. Process Elements
Important
Generic Process Element Properties
- ID
- ID defined as a String unique in the parent Knowledge Base
- Name
- Element display name
A.7. Start Event
- None Start Event
- Signal Start Event
- Timer Start Event
- Conditional Start Event
- Message Start Event
- Compensation Start Event
A.7.1. Start Event types
A.7.1.1. None Start Event
A.7.1.2. Message Start Event
Attributes
- Message
- ID of the expected Message object
A.7.1.3. Timer Start Event
Attributes
- Timer
- Timing definition
A.7.1.4. Escalation Start Event
Attributes
- Escalation Code
- Expected Escalation Code
A.7.1.5. Conditional Start Event
true after the Start Event has been instantiated.
false and then to true.
Attributes
- Condition
- Boolean condition
A.7.1.6. Error Start Event
Attributes
- ErrorCode
- code of the expected Error object
A.7.1.7. Compensation Start Event
A.7.1.8. Signal Start Event
Attributes
- SignalCode
- Expected Signal Code
A.8. Intermediate Events
A.8.1. Intermediate Events
- in a Process workflow with one optional incoming and one outgoing Flow:
- The event is executed as part of the workflow. If the Event has no incoming Flow, its execution is triggered always when the respective trigger occurs during the entire Process instance execution. If the Event has an incoming Flow it is executed as part of the Process workflow. Once triggered, the Event's outgoing Flow is taken only after the respective Event has occurred.
- on an Activity boundary with one outgoing Flow:
- If the Event occurs while the Activity is being executed, the Event triggers its execution to the outgoing Flow. One Activity may have multiple boundary Intermediate Events. Note that depending on the behavior you require from the Activity with the boundary Intermediate Event, you can use either of the following Intermediate Event type:
- interrupting: the Activity execution is interrupted and the execution of the Intermediate Event is triggered.
- non-interrupting: the Intermediate Event is triggered and the Activity execution continues.
- Timer Intermediate Event
- delays the execution of the outgoing Flow.
- Conditional Intermediate Event
- is triggered when its condition evaluates to
true. - Error Intermediate Event
- is triggered by an Error object with the given Error Code.
- Escalation Intermediate Event
- has two subtypes: Catching Escalation Intermediate Event that is triggered by a Escalation and Throwing Escalation Intermediate Event that produces an Escalation when executed.
- Signal Intermediate Event
- has two subtypes: Catching Signal Intermediate Event that is triggered by a Signal and Throwing Signal Intermediate Event that produces a Signal when executed.
- Message Intermediate Event
- has two subtypes: Catching Message Intermediate Event that is triggered by a Message and Throwing Message Intermediate Event that produces a Message when executed.
A.8.2. Intermediate Event types
A.8.2.1. None Intermediate Event
A.8.2.2. Timer Intermediate Event
Attributes
- Message
- ID of the expected Message object
- Timer delay
- Time delay before the Event triggers its outgoing Flow for the first time
- Timer period
- Period between two subsequent triggersIf set to
0, the Event execution is not repeated.
A.8.2.3. Conditional Intermediate Event
true and its outgoing Flow is taken.
true.
Attributes
- Condition
- Boolean condition that must be evaluated to true for the execution to continue
A.8.2.4. Message Intermediate Event
- Throwing Message Intermediate Event produces a Message object based on the defined properties
- Catching Message Intermediate Event listens for a Message object with the defined properties
A.8.2.5. Compensation Intermediate Event
A.8.2.6. Message Intermediate Event types
A.8.2.6.1. Throwing Message Intermediate Event
Attributes
- CancelActivity
- if the Event is place on the boundary of an Activity and the Cancel Activity property is set to
true, the Activity execution is cancelled immediately when the Event receives its Escalation object. - MessageRef
- ID of the produced Message object
A.8.2.6.2. Catching Message Intermediate Event
Attributes
- MessageRef
- ID of the expected Message object
A.8.2.7. Escalation Intermediate Event
- Throwing Escalation Intermediate Event produces an Escalation object based on the defined properties
- Catching Escalation Intermediate Event listens for an Escalation object with the defined properties
A.8.2.8. Escalation Intermediate Event types
A.8.2.8.1. Throwing Escalation Intermediate Event
Attributes
- EscalationCode
- ID of the produced Escalation object
A.8.2.8.2. Catching Escalation Intermediate Event
Attributes
- EscalationCode
- code of the expected Escalation object
- CancelActivity
- if the Event is place on the boundary of an Activity and the Cancel Activity property is set to
true, the Activity execution is cancelled immediately when the Event receives its Escalation object.
A.8.2.9. Error Intermediate Event
Attributes
- ErrorRef
- reference number of the Error object the Event is listening for
A.8.2.10. Error Intermediate Event types
A.8.2.10.1. Throwing Error Intermediate Event
Attributes
- ErrorRef
- reference number of the produced Error object
A.8.2.10.2. Catching Error Intermediate Event
Attributes
- ErrorRef
- reference number of the expected Error object
- CancelActivity
- if the Event is place on the boundary of an Activity and the Cancel Activity property is set to
true, the Activity execution is cancelled immediately when the Event receives its Escalation object.
A.8.2.11. Signal Intermediate Event
- Throwing Signal Intermediate Event produces a Signal object based on the defined properties
- Catching Signal Intermediate Event listens for a Signal object with the defined properties
A.8.2.12. Signal Intermediate Event types
A.8.2.12.1. Throwing Signal Intermediate Event
Attributes
- SignalRef
- The Signal code that is to be sent or consumed
- CancelActivity
- if the Event is place on the boundary of an Activity and the Cancel Activity property is set to
true, the Activity execution is cancelled immediately when the Event receives its Escalation object.
A.8.2.12.2. Catching Signal Intermediate Event
Attributes
- SignalRef
- reference code of the expected Signal object
A.9. End Events
A.9.1. End Event types
A.9.1.1. Simple End Event
Important
true.
A.9.1.2. Message End Event
A.9.1.3. Escalation End Event
A.9.1.4. Terminate End Event
Note
Terminate property in the Property tab of the Simple End Event as true.
A.9.1.5. Throwing Error End Event
Attributes
- ErrorRef
- reference code of the produced Error object
A.9.1.6. Cancel End Event
A.9.1.7. Compensation End Event
A.9.1.8. Signal End Event
A.10. Gateways
A.10.1. Gateways
- Parallel (AND): in a converging gateway, waits for all incoming Flows. In a diverging gateway, takes all outgoing Flows simultaneously;
- Inclusive (OR): in a converging gateway, waits for all incoming Flows whose condition evaluates to true. In a diverging gateway takes all outgoing Flows whose condition evaluates to true;
- Exclusive (XOR): in a converging gateway, only the first incoming Flow whose condition evaluates to true is chosen. In a diverging gateway only one outgoing Flow is chosen.
- Event-based: used only in diverging gateways for reacting to events. See Section A.10.2.1, “Event-based Gateway”
- Data-based Exclusive: used in both diverging and converging gateways to make decisions based on available data. See Section A.10.2.4, “Data-based Exclusive Gateway”
A.10.2. Gateway types
A.10.2.1. Event-based Gateway
A.10.2.2. Parallel Gateway
- Diverging
- Once the incoming Flow is taken, all outgoing Flows are taken simultaneously.
- Converging
- The Gateway waits untill all incoming Flows have entered and only then triggers the outgoing Flow.
A.10.2.3. Inclusive Gateway
- Diverging
- Once the incoming Flow is taken, all outgoing Flows whose condition evaluates to true are taken. Connections with lower priority numbers are triggered before triggering higher priority ones; priorities are evaluated but the BPMN2 specification doesn't guarantee this. So for portability reasons it is recommended that you do not depend on this.
Important
Make sure that at least one of the outgoing Flow evaluates to true at runtime; otherwise, the process instance terminates with a runtime exception. - Converging
- The Gateway merges all incoming Flows previously created by a diverging Inclusive Gateway; that is, it serves as a synchronizing entry point for the Inclusive Gateway branches.
Attributes
- Default gate
- The outgoing Flow taken by default if no other Flow can be taken
A.10.2.4. Data-based Exclusive Gateway
- Diverging
- The Gateway triggers exactly one outgoing Flow: the Flow with the constraint evaluated to true and the lowest Priority is taken. After evaluating the constraints that are linked to the outgoing Flows: the constraint with the lowest priority number that evaluates to true is selected.
Important
Make sure that at least one of the outgoing Flows evaluates to true at runtime: if no Flow can be taken, the execution returns a runtime exception. - Converging
- The Gateway allows a workflow branch to continue to its outgoing Flow as soon as it reaches the Gateway; that is, whenever on of the incoming Flows triggers the Gateway, the workflow is sent to the outgoing Flow of the Gateway; if it is triggered from more than one incoming connection, it triggers the next node for each trigger.
Attributes
- Default gate
- The outgoing Flow taken by default if no other Flow can be taken
A.11. Activities, Tasks and Sub-Processes
A.11.1. Activity
"An Activity is work that is performed within a Business Process." [7]
A.11.2. Activity mechanisms
A.11.2.1. Multiple instances
A.11.2.2. Activity types
A.11.2.2.1. Call Activity
Attributes
- Called Element
- ID of the Process to be called and instantiated by the Activity
A.11.3. Tasks
A.11.3.1. Task types
None Task or the Abstract Task (deprecated).
User Task.
A.11.3.2. Generic Task
"Abstract Task: Upon activation, the Abstract Task completes. This is a conceptual model only; an Abstract Task is never actually executed by an IT system." [9]
A.11.3.3. Send Task
"Send Task: Upon activation, the data in the associated Message is assigned from the data in the Data Input of the Send Task. The Message is sent and the Send Task completes." [10]
Attributes
- MessageRef
- the MessageRef of the generated Message
A.11.3.4. Receive Task
"Upon activation, the Receive Task begins waiting for the associated Message. When the Message arrives, the data in the Data Output of the Receive Task is assigned from the data in the Message, and Receive Task completes." [11]
Attributes
- MessageRef
- the associated Message
A.11.3.5. Manual Task
"Upon activation, the Manual Task is distributed to the assigned person or group of people. When the work has been done, the Manual Task completes. This is a conceptual model only; a Manual Task is never actually executed by an IT system." [12]
A.11.3.6. Service Task
ServiceTaskHandler to invoke Java methods or Web Services.
Attributes
- Implementation
- The underlying technology that will be used to implement this task. You can use
unspecifiedorWebServicewhereWebServiceis the default value. - OperationRef
- This attribute specifies the operation that is invoked by the Service Task. (typically method of Java class or method of WebService).
A.11.3.7. Business Rule Task
Attributes
- RuleFlow Group
- the name of the rule flow group that includes the set of rules to be evaluated by the Task
A.11.3.8. Script Task
- Avoid low-level implementation details in the Process: A Script Task could be used to manipulate variables but other concepts like a Service Task should be your first choice when modeling more complex behavior in a higher-level manner.
- The script should be executed immediately; if there is the possibility that the execution could take some time, use an asynchronous Service Task.
- Avoid contacting external services through a Script Task: it would be interacting with external services without the knowledge of the engine, which can be problematic. Model communication with an external service using a Service Task.
- Scripts should not throw exceptions. Runtime exceptions should be caught and for example managed inside the script or transformed into signals or errors that can then be handled inside the process.
Attributes
- Script
- script to be executed
- ScriptLanguage
- language the script is defined in (currently supported languages are Java and MVEL)
A.11.4. Sub-Process
- Ad-Hoc Sub-Process: Sub-Process with no strict Element execution order
- Embedded Sub-Process: a "real" Sub-Process that is a part of the Parent Process execution and shares its data
- Reusable Sub-Process: a Sub-Process that is independent from its parent Process
- Event Sub-Process: a Sub-Process that is only triggered on a start event or a timer.
A.11.4.1. Embedded Sub-Process
A.11.4.2. AdHoc Sub-Process
Attributes
- AdHocCompletionCondition
- the condition that once met the execution is considered sucessful and finishes
- AdHocCancelRemainingInstances
- if set to
true, once the AdHocCompletionCondition is met, execution of any Elements is immediately cancelled
A.11.4.3. Multi-instance Sub-Process
Attributes
- Collection expression
- Variable that represents the collection of elements that are to be iterated over (The variable must be an array or be of the java.util.Collection type.)If the collection expression evaluates to null or an empty collection, the Multi-Instances Sub-Process is completed immediately and the outgoing flow is taken.
- Variable Name
- Variable that will store the collection element used in the currently running iteration
A.11.4.4. Event Sub-Process
A.11.5. User Task
"A User Task is a typical 'workflow' Task where a human performer performs the Task with the assistance of a software application and is scheduled through a task list manager of some sort." [17]
GroupID, it is displayed in Task lists of all users that are members of the group: any of the users can claim the Task. Once claimed, the Task disappears from the Task lists of the other users.
Attributes
- Actors
- comma-separated list of users who are entitled to perform the generated User Task
- Comment
- A comment associated with this User Task. The JBoss BPM Suite Engine does not use this field but business users can enter extra information about this task.
- Content
- The data associated with this task. This attribute does not affect TaskService's behavior.
- CreatedBy
- name of the user or ID of the Process that created the task
- GroupID
- comma-separated list of groups who are entitled to perform the generated User Task
- Locale
- locale the Element is defined for. This was intended to support internationalization (i18n), but this property is not used by the JBoss BPM Suite engine at the moment.
- Notifications
- Definition of notification applied on the Human Task (refer to Section A.11.5.3, “Notification”)
- Priority
- Integer value defining the User Task priority (the value influences the User Task ordering in the user Task list and the simulation outcome)
- Reassignment
- Definition of escalation applied on the Human Task (refer to Section A.11.5.2, “Reassignment”)
- ScriptLanguage
- One of Java or MVEL.
- Skippable
- Boolean value that defines if the User Task can be skipped (if
true, the actor of the User Task can decide not to complete it and the User Task is never executed) - Task Name
- Name of the User Task generated on runtime (displayed in the Task List of Business Central)
A.11.5.1. User Task lifecycle
Created stage. This is usually a transient state and the User Task enters the Ready state immediately: the User Task appears in the Task Lists of all actors that are allowed to execute the task. As soon as one of the actors claims the User Task to indicate they are executing it, the User Task becomes Reserved. If a User Task has only one potential actor, it is automatically assigned to that actor upon creation. When the user who has claimed the User Task starts the execution, the User Task status changes to InProgress. On completion, the status changes to Completed or Failed depending on the execution outcome.
A.11.5.2. Reassignment
- not started:
READYorRESERVED - not completed:
IN_PROGRESS
Users: comma-separated list of user IDs that are reassigned to the task on escalation (Strings or expressions #{user-id})Groups: comma separated list of group IDs that are reassigned to the task on escalation (Strings or expressions #{group-id})Expires At: time definition when escalation is triggered (String values and expressions #{expiresAt}; for information on time format, refer to Section A.5, “Timing”)Type: state the task needs to be in at the given Expires At time so that the escalation is triggered.
A.11.5.3. Notification
- not started:
READYorRESERVED - not completed:
IN_PROGRESS
Type: state the User Task needs to be in at the given Expires At time so that the notification is triggeredExpires At: time definition when notification is triggered (String values and expressions #{expiresAt}; for information on time format, refer to Section A.5, “Timing”)From: user or group ID of users used in the From field of the email notification message (Strings or expressions)To Users: comma-separated list of user IDs the notification is to be sent to (Strings or expressions #{user-id})To Groups: comma separated list of group IDs the notification is to be sent to (Strings or expressions #{group-id})Reply To: user or group ID that receives any replies to the notification (Strings or expressions #{group-id})Subject: subject of the email notification (Strings or expressions)Body: body of the email notification (Strings and expression)
Available variables
#{processVariable}) and Task variables (${taskVariable}). Note that process variables are resolved at Task creation and Task variables are resolved at notification time. In addition to custom Task variables, the notification mechanism can make use of the following local Task variables:
taskId: internal ID of the User Task instanceprocessInstanceId: internal ID of Task's parent Process instanceworkItemId: internal ID of a work item that created the User TaskprocessSessionId: knowledge session ID of the parent Process instanceowners: list of users and groups that are potential owners of the User Taskdoc: map that contains regular task variables
Example A.8. Body of notification with variables
<html>
<body>
<b>${owners[0].id} you have been assigned to a task (task-id ${taskId})</b><br>
You can access it in your task
<a href="http://localhost:8080/jbpm-console/app.html#errai_ToolSet_Tasks;Group_Tasks.3">inbox</a><br/>
Important technical information that can be of use when working on it<br/>
- process instance id - ${processInstanceId}<br/>
- work item id - ${workItemId}<br/>
<hr/>
Here are some task variables available
<ul>
<li>ActorId = ${doc['ActorId']}</li>
<li>GroupId = ${doc['GroupId']}</li>
<li>Comment = ${doc['Comment']}</li>
</ul>
<hr/>
Here are all potential owners for this task
<ul>
$foreach{orgEntity : owners}
<li>Potential owner = ${orgEntity.id}</li>
$end{}
</ul>
<i>Regards from jBPM team</i>
</body>
</html>A.12. Connecting objects
A.12.1. Connecting Objects
- Sequence Flow, which connect Flow elements of a Process and define the flow of the execution (transport the token from one element to another)
- Association Flow, which connect any Process elements but have no execution semantics
A.12.2. Connecting Objects types
A.12.2.1. Sequence Flow
Properties
- Condition Expression
- A condition that needs to be true to allow the workflow to take the Sequence FlowIf a Sequence Flow has a Gateway element as its source, you need to define a Conditional Expression, which is evaluated before the Sequence Flow is taken. If false, the workflow attempts to switch to another Sequence Flow. If true, the Sequence Flow is taken.When defining the condition in Java, make sure to return a boolean value:
return <expression resolving to boolean>;
- Condition Expression Language
- You can use either Java or Drools to define the Condition Expression.
Note
kcontext variable, which holds the Process instance information.
A.13. Swimlanes
A.13.1. Lanes
"A Lane is a sub-partition within a Process (often within a Pool)... " [18]
analyst value. When the Process is started, and UT1 is claimed/started/completed by an analyst user, UT2 gets claimed and assigned to the user who completed UT1. On the other hand, if only UT1 had the analyst group assigned, and UT2 had no user or group assignments, the process would stop after UT1 had been completed.
A.14. Artifacts
A.14.1. Artifacts
A.14.2. Data Objects
Appendix B. Service Tasks
Note
B.1. Log Task
Input attributes
- Message
- the log message text
B.2. Email Task
Input attributes
- To
- the recipient of the email
- From
- the sender of the email
- Subject
- the subject of the email
- Body
- the body of the email
B.3. REST Task
Input attributes
- Method
- the REST method of the call (such as,
GET,POST, etc.) - ConnectTimeout
- the call timeout
- Username
- the user name to be used to perform the call
- Password
- the user password
- ReadTimeout
- timeout on response receiving
- Url
- target URL including the request body
Output attributes
- Result
- string with the result of the call
B.4. WS Task
Input attributes
- Parameter
- The object or array to be sent for the operation
- Mode
- One of SYNC, ASYNC or ONEWAY.
- Interface
- The name of a service. For example:
Weather - Namespace
- namespace of the web service, such as
http://ws.cdyne.com/WeatherWS// - URL
- the web service URL, such as
http://ws.cdyne.com/ - Operation
- the actual method name to call
Output attributes
- Result
- object with the result
Appendix C. Simulation data
C.1. Process
Simulation attributes
- Base currency
- currency to be used for simulation
- Base time unit
- time unit to apply to all time definitions in the Process
C.2. Start Event
Simulation attributes
- Wait time
- time to wait as to simulate the execution of the Start Event
- Time unit
- time unit to be used for the wait time property
C.3. Catching Intermediate Events
Simulation attributes
- Wait time
- time to wait as to simulate the execution of the Catching Intermediate Event
- Time unit
- time unit to be used for the wait time property
C.4. Sequence Flow
Simulation attributes
- Probability
- probability the Flow is taken in percentThe probability value is applied only if the Flow's source element is a Gateway and there are multiple Flow elements leaving the Gateway. When defining Flow probabilities, make sure their sum is 100.
C.5. Throwing Intermediate Events
Simulation attributes
- Distribution type
- distribution type to be applied to the processing time values
C.6. Human Tasks
Simulation attributes
- Cost per time unit
- costs for every time unit lapsed during simulation
- Currency
- currency of the cost per unit property
- Staff availability
- number of actors available to work on the given Task
Example C.1. Staff availability impact
Let's assume a simulation of 3 instances of a Process. A new instance is created every 30 minutes. The Process contains a None Start Event, a Human Task, and a Simple End Event. The Human Task takes 3 hours to complete, the Working hours is set to3. We have only one person to work on the Human Tasks, that is Staff availability is set to1. That results in the following:- The Human Task generated by the first Process instance will be executed after 3 hours;
- The Human Task generated by the second Process instance will be executed in approx. 6 hours (the second Process instance is created after 30 minutes; however, the actor is busy with the first Task; he becomes available only after another 2.5 hours, and takes 3 hours to execute the second Task).
- The Human Task generated by the third Process instance will be executed in approx. 9 hours (the second Human Task instance is finished after 3 hours; the actor needs another 3 hours to complete the third Human Task).
- Working hours
- time period for simulation of the Task execution
C.7. Service Tasks
Simulation attributes
- Cost per time unit
- costs for every time unit lapsed during simulation
- Currency
- currency of the cost per unit property
- Distribution type
- distribution type to be applied to the element execution time
C.8. End Events
Simulation attributes
- Distribution Type
- distribution type to be applied to the element execution time
C.9. Distribution types
normal: bell-shaped, symmetricaluniform: rectangular distribution; every score (time period) is applied the same number of timesPoisson: negatively skewed normal distribution
C.9.1. Normal
Normal distribution type
- Processing time (mean)
- mean processing time the element needs to be processed (in time unit defined in the time units property)
- Standard deviation
- standard deviation of the processing time (in time unit defined in the time units property)
- Time unit
- time unit to be used for the mean processing time and standard deviation values
C.9.2. Uniform
Uniform distribution type
- Processing time (max)
- maximum processing time of the element
- Processing time (min)
- minimum processing time of the element
- Time unit
- time unit to be used for the processing time values
C.9.3. Poisson
Poisson distribution type
- Processing time (mean)
- mean time for the element processing (in time unit defined in the time units property)
- Time unit
- time unit to be used for the mean processing time
Appendix D. Revision History
| Revision History | |||
|---|---|---|---|
| Revision 1.0.0-43 | Thu Dec 17 2015 | ||
| |||



