Skip to main content

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: PurchaseOrderProcessDefinition Example process It is usual for a system that executes several process instances to have many human task instances that are waiting for an external human action. BPMDefaultAssignment Default task list This is referred to as task assigning integration.

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: ReviewPurchaseOrderTaskConfiguration Human task configuration At runtime, every time a new instance of the Review Purchase Order task is created it is automatically assigned to the PurchaseDepartment group with the status Ready. This makes the task automatically available to all users that belong to the group. All users in the group see it on their respective Task Inbox but none are the actual owner or responsible for the task. To be able to work with a particular task, a user must execute the claim operation to reserve the task for that user. The following image shows an example of the claim operation execution for the task #152: UserClaimsTask User claims a task When the claim operation is executed, the task status is changed to Reserved and the task is assigned to the claiming user. In the preceding example, the claimer of the task is the wbadmin user. After the user claims the task, he is known as the task “actual owner”. TaskClaimed Task claimed by wbadmin Although this is the standard procedure for most BPMS products, it is not flexible enough for all use cases. For example, this procedure does not work well with scenarios where an optimal distribution of a huge set of tasks between users by given criteria is required. In these cases, users usually find a large list of tasks up-front but do not have the knowledge to claim and execute them in the best way. All of the configuration parameters that are defined in the next topics are defined through the Java system properties. In Wildfly and Red Hat Enterprise Application Server (EAP) installations, these parameters are usually configured in the <system-properties> section of the selected configuration file, for example:
You can also use other methods of setting system properties, for example passing JVM parameters on the command line:
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: LabelingMechanismTasks Tasks Labeling
  1. Any human task is created in the processes runtime.
  2. When the new task is detected by the task assigning solution refreshing mechanism, a set of LabelValueExtractors is applied.
  3. These LabelValueExtractors can transform any piece of information in the human task or user into a label.
  4. The default constraints consider these labels.
In the preceding example, the following labels are produced:
  • 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.
User labeling works in a similar way: LabelingMechanismUsers Users Labeling

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. SkillsAndAffinitiesConfigurationExample Skills and affinities configuration The example above links the process variable “variableWithTheSkills” with the task input name “skills”, and the corresponding value will be processed by the “DefaultTaskDataSkillsValueExtractor” and automatically associated with the label name SKILLS. This mechanism can be used for any other user provided LabelValueExtractor.

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.
  1. 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:
  1. 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
When configured, the LabelValueExtractor will be processed accordingly. The following example shows a custom LabelValueExtractor:
Ensure that the following dependency is added to the specified KJAR:
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:
Both classes are found in the following maven artifact:
The following table shows the parameter name and the expected type.

Querying the human tasks as TaskData instances

This query execution variant enables getting the result values as instances of:
The following example shows how to use this variant: Example 1)
In this case, only the tasks currently assigned by the task assigning integration will be considered. This is the usual scenario when task assigning integration is enabled, because it is expected that the tasks are consumed and executed according to the generated planning.
The task inputs and potential owners are not loaded by this query.
Example 2)
In this case all of the tasks will be considered but only the tasks assigned by the task assigning integration will have the TaskData.planningTask filled. It means that non-assigned tasks or tasks not yet managed by the task assigning integration might be included in the results. This alternative facilitates a more advanced processing of the “potential” tasks, however it is strongly encouraged to make available to the users only the tasks that are currently assigned by the task assigning integration, i.e. the ones with TaskData.planningTask != null, otherwise the integration becomes senseless.
The task inputs and potential owners are not loaded by this query.
See KIE Server API documentation for more information on how to create the KIE Server clients and the query API general functioning.

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. CreditDisputeProcess Credit dispute process

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. StartCreditDisputeForm Start credit dispute process form

Process configuration

The following image shows the process variables that are used for holding the card brand and language respectively. CreditDisputeProcessWithVariables Credit dispute process variables The process start form populates these variables with the user inputs.

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. ResolveDisputeTaskConfiguration

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. NotifyCustomerTaskConfiguration

Process execution (example users)

Let’s assume that the following user configurations are used for executing the process. users.properties file:
skills.properties file:

Process execution (example instances)

With the preceding configurations the following execution scenarios are expected: Process instance #1:
  1. Start process
StartCreditDisputeInstance1Simple Start credit dispute process instance #1
  1. ResolveDispute task
ResolveDisputeTaskForProcessInstance1WasCreated Resolve dispute task for process instance #1 The ResolveDispute task is assigned to the user maciek since it requires VISA skills.
  1. NotifyCustomer task
NotifyCustomerTaskForProcessInstance1WasCreated Notify customer task for process instance #1 When the ResolveDispute task is completed, a new task NotifyCustomer is created and assigned to the user john because that task requires skills in Spanish. Process instance #2:
  1. Start process
StartCreditDisputeInstance2Simple Start credit dispute process instance #2
  1. ResolveDispute task
ResolveDisputeTaskForProcessInstance2WasCreated Resolve dispute task for process instance #2 The ResolveDispute task is assigned to the user katy since it requires CITI skills.
  1. NotifyCustomer task
NotifyCustomerTaskForProcessInstance2WasCreated Notify customer task for process instance #2 When the ResolveDispute task is completed, a new task NotifyCustomer is created and assigned to the user mary because that task requires skills in Chinese. Process instance #3:
  1. Start process
StartCreditDisputeInstance3Simple Start credit dispute process instance #3
  1. ResolveDispute task
ResolveDisputeTaskForProcessInstance3WasCreated Resolve dispute task for process instance #3 The ResolveDispute task is assigned to the user katy because that task requires skills in the MASTER card.
  1. NotifyCustomer task
NotifyCustomerTaskForProcessInstance3WasCreated Notify customer task for process instance #3 When the ResolveDispute task is completed, a new task NotifyCustomer is created and assigned to the planninguser because none of the users has the required skills in Hindi. In this case, an external interaction is required to determine the best suited user to complete the task. The planninguser must perform this action by delegating the 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:
  1. Create a KJAR project structure
  2. Add the following dependency
  1. Provide your UserSystemService implementation, see the following example:
  1. Add the following resource to the project and declare your user system service provider class on it.
Finally, for using it in the Planning kie-server follow these steps:
  1. Build your KJAR and be sure the corresponding maven generated artifact is installed in the maven repository used by your Planning kie-server.
  2. 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
  3. Finally add the following items to the Planning kie-server configuration file: