4.6. Creating a Business Process Save Point

To ensure the engine will save the state of the process, a save point is created when a node is executed asynchronously. Asynchronous continuation allows process designers to decide what activities should be executed asynchronously without any additional work.
Using the Process Design tool, you can decide which nodes should be executed in the background. The following example shows two types of tasks:
  • Synchronous (Sync Service)
  • Asynchronous (Async Service)
In the provided example, the Async Service will be executed in background while Sync Service will be executed on the same thread as its preceding node - so if the preceding node is asynchronous, the synchronous node will directly follow it within same thread.
Use the following procedure to make a service task asynchronous.

Procedure 4.2. Define a Service Task as Asynchronous

  1. Open the Properties menu on the right side of te Business Process screen.
  2. Select Service Task you want to make asynchronous in the Process Modelling window.
  3. Under the Extra Properties menu, set the Is Async option to true.
This feature is available for all task types (service, send, receive, business rule, script, user task), subprocesses (embedded and reusable), and multi-instance task and subprocesses.

Note

This feature relies on the ExecutorService, which is the backbone of asynchronous processing in JBoss BPM Suite. The ExecutorService must be configured and running in order to use this feature. This is already fully equipped in Business Central, however if using JBoss BPM Suite in embedded mode, additional steps will be required depending on how you utilize the JBoss BPM Suite API.

4.6.1. Enabling Asynchronous Execution in Embedded Mode

To enable save points by allowing nodes to execute asynchronously in embedded mode, the following steps will be required depending on your API.

KIE API (KieBase and KieSession)

When using the KIE API, configure ExecutorService and add it to kieSession environment under "ExecutorService" key. Once this has been added, it will process the nodes asynchronously.

RuntimeManager API

Configure ExecutorService and add it as one of environment entries when setting up RuntimeEnvironment.

jBPM Services API

Add ExecutorService as an attribute of DeploymentService. If you use CDI or EJB it will be injected automatically (assuming all dependencies are available to the container).