Introduction to business processes
Business process management systems (BPMS) products such as jBPM have the ability to model and execute multiple business processes. A business process is typically composed of nodes such as events, gateways, and tasks that are connected to each other for defining the process flow. Every type of node has a specific semantic and is instantiated by the process runtime engine when a process instance is executed. Business processes that require human interaction are modelled by using human task nodes. The following image shows a process where three tasks require human interaction:

BPM standard task assigning
In general, business process runtime engines assign human tasks to users on a group basis. The target audience is usually included as part of the human task configuration. The following image shows how the Review Purchase Order human task is configured with the PurchaseDepartment group:

wbadmin user. After the user claims the task, he is known as the task “actual owner”.

<system-properties> section of the selected configuration file, for example:
It is recommended to use the same configuration method for all KIE Server required parameters.
Process Runtime kie-server configuration
The following table shows the only parameter that must be configured in all of the Process Runtime kie-servers in the target topology.Process Runtime kie-server Wildfly/EAP configuration example
Planning kie-server configuration
The following topics explain the parameters that you must configure in the Planning kie-server. Whatever the target topology is, only one instance of this server will exist.The parameters tagged as “Required” must be set only in cases where the task assigning integration is enabled. Some of them have a default value that automatically applies when not set.
Global configuration parameters
Planning kie-server Wildfly/EAP configuration example
Below is an extract of the task assigning configuration parameters for a Wildfly/EAP server.Spring Boot configuration
When the KIE Server Spring Boot Starter version is used the following configuration parameters are used to configure the task assigning integration. These parameters are usually configured in the corresponding Spring Boot application.properties file. The same statements as for standard KIE Server topologies apply in this case.Default Constraints
The following table gives a high level description of the set of constraints that are included in the task assigning integration. These constraints are used for the construction of the optimized plan, in other words “for determining which tasks should be assigned to whom”. In general a large set of use cases can be covered by using them and no extensions are required, but it is possible to work with a user-provided customized set of constraints if needed, see Container based solver configuration. Optimized solutions construction is made by using a BendableLongScore with two levels of Hard constraints and six levels of Soft constraints. These constraint levels can be customized by following a set of restrictions.The current TaskAssigningSolution implementation is based on a BendableLongScore scoring function and thus any potential extension of the provided constraints, etc., typically by using a user provided KJAR, will be based on it.
However this scoring function as well as the core model classes might change in future releases.
Constraints configuration by using a DRL file
The following example shows the key parts of the DRL file that contains the constraints configurations.The current default DRL might change in future versions and thus cannot be considered as part of the product public API. Any potential customization of the provided constraints might use this DRL as a starting point or could also use other mechanisms such as the constraints streams for implementing them.
Skills and Affinities
The use of skills and affinities implements the ability of declaring business related data for being considered by the default provided constraints or any other user defined ones. This is a fine grained decision mechanism that you can use on top of the groups-based assignment semantics defined in the business process. Internally, this mechanism is based on the ability to label the human tasks generated by the business processes runtime and the users information. Labeling mechanism The following procedure shows how the labeling mechanism converts information in human tasks and users information to labels:
- Any human task is created in the processes runtime.
- When the new task is detected by the task assigning solution refreshing mechanism, a set of LabelValueExtractors is applied.
- These LabelValueExtractors can transform any piece of information in the human task or user into a label.
- The default constraints consider these labels.
- The input data “skills”, with the value “skill1, skill2” resulted in the label SKILLS with the following set of values {“skill1”, “skill2”}
- The input data “affinities” with the value “affinity1” resulted in the label AFFINITIES with the following set of values {“affinity1”}
Task labels are calculated only the first time the task is identified by the task assigning integration and can use any of the information present in the task.

Default HumanTask and User LabelValueExtractors
Four label value extractors are provided to manage the SKILLS and AFFINITIES labels.The current core model classes like the TaskAssigningSolution, Task and User might change in future releases.
Linking the human tasks inputs with the labels
A simple approach for labeling tasks with business related information is implemented using the task inputs configuration. The following image shows an example of such a configuration.
Custom extractors
Installations that require the definition of customized LabelValueExtractors can add them by providing their implementations in the customized KJARs with the UserSystemIntegration implementation or the Solver configuration.- Add a component in the specified KJAR that implements the following interface: org.kie.server.api.model.taskassigning.data.LabelValueExtractor Note: Ensure that the following dependency is added to the given KJAR:
- Declare the component implementation by using the Java standard service provider mechanism in the following resource: project_home/src/main/resources/META-INF/services/org.kie.server.api.model.taskassigning.data.LabelValueExtractor
Extractors for processing the human tasks information must use the class
org.kie.server.api.model.taskassigning.TaskData as source type.
The current core model classes like the TaskAssigningSolution, Task and User might change in future releases.
Integration alternatives
System integrators usually consume the human tasks available in the Process Runtime kie-server for different purposes. One example is the Business Central “Task Inbox”. In this case, Business Central acts as an “integrator” which means that the human tasks are consumed from the Process Runtime kie-server by using the kie-server queries APIs and applying different filtering criterias. Finally these tasks are listed in the “Task Inbox” UI, etc. In this way, Business Central is decoupled from the Process Runtime kie-server, etc. The next topics present a set of queries similar to queries used by the Business Central “Task Inbox”. These queries might facilitate integrations in cases where the task assigning integration is enabled.Task Assigning Human Tasks Query
This query facilitates the consumption of the available human tasks. The task can integrate additional information depending on the query variant. It is up to the “integrator” to select the query variant that best supports its needs.Filtering parameters
The available filtering parameters are defined in the following kie-server-api enums:Querying the human tasks as TaskData instances
This query execution variant enables getting the result values as instances of:The task inputs and potential owners are not loaded by this query.
The task inputs and potential owners are not loaded by this query.
Examples
Credit dispute process
The following credit dispute process example is intended to show a simple use case where you can use the “skills” configuration to influence the way tasks are assigned according to the solver constraints and the process data.
Process start
When the process starts, the user is asked to complete the information in the following image. In particular, the credit card brand for which the dispute is related to and the preferred language for receiving the process notifications are requested. This information is used for assigning the process tasks.
Process configuration
The following image shows the process variables that are used for holding the card brand and language respectively.
Resolve dispute task configuration
The following image shows the ResolveDispute task configuration, which establishes that the task input parameter skills is assigned with the value of the process variable cardType.
Notify customer task configuration
The following image shows the NotifyCustomer task configuration, which establishes that the task input parameter skills is assigned with the value of the process variable language.
Process execution (example users)
Let’s assume that the following user configurations are used for executing the process. users.properties file:Process execution (example instances)
With the preceding configurations the following execution scenarios are expected: Process instance #1:- Start process

- ResolveDispute task

- NotifyCustomer task

- Start process

- ResolveDispute task

- NotifyCustomer task

- Start process

- ResolveDispute task

- NotifyCustomer task

The planninguser assignment is used to cover edge cases and should not be part of the modelling strategy.
In the preceding example, if it is known that no user will have skills in Hindi, a similar but softer constraint can be configured by using affinities.
Customized User System Service
For creating a custom user system service implementation follow these steps:- Create a KJAR project structure
- Add the following dependency
- Provide your UserSystemService implementation, see the following example:
- Add the following resource to the project and declare your user system service provider class on it.
- Build your KJAR and be sure the corresponding maven generated artifact is installed in the maven repository used by your Planning kie-server.
- Add a datasource configuration to your Planning kie-server pointing to the target DB (this step is only required for the example above). For example with JNDI name java:jboss/datasources/db-user-system-datasource
- Finally add the following items to the Planning kie-server configuration file: