This section provides information on how to access the technology preview and describes how to create a stateful hiring process through an example: jbpm-compact-architecture-example. This example drives a candidate through different interviews to the successful hiring decision. The example includes the use of DMN decisions to generate the candidate offer and timers to skip user tasks.

Accessing the technology preview

The features from the technology preview can be accessed by importing the technology preview bill of materials (BOM). A bill of materials (BOM) can be added to an existing POM file by adding it to the dependencyManagement section as a dependency with a pom type:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.ibm.bamoe</groupId>
            <artifactId>bamoe-techpreview-bom</artifactId>
            <version><!-- See Version Mapping Table --></version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>
Table 1. Version Mapping for IBM BAMOE Version 9.1.x
Product Version BOM Version Maven Library Version

IBM BAMOE 9.1.0

9.1.0-ibm-0001

9.1.0-ibm-0001

After the technology preview bill of materials is added, individual features from it can be enabled by adding relevant dependencies declared in the technology preview bill of materials to the dependencies section of an existing POM file.

Creating and Configuring a BPMN Workflow

In this section we will focus on how to build and configure the Hiring process in Canvas.

For information on setting up Canvas see Canvas installation

Create Process Variables

  1. Open Canvas with workflow elements.

  2. Click anywhere in the canvas and then click on the properties tab to access the properties panel.

    Canvas for workflow showing properties
    Figure 1. Canvas for workflow showing properties
  3. Set the following properties:

    • Name: Provide a label for the process.

    • ID: Specify an identifier that will be used for endpoints.

    • Description: Write a detailed description of the process.

  4. To add input variables:

    • Click the plus button to add a new variable.

    • Set the variable’s name and data type.

      • Name is the ID and name of the variable which can be referenced via scripts or input/output of activities.

      • Data type refers to a Java type. If you click Select Custom, the field turns into the fully qualified name of the class.

Setting process properties
Figure 2. Process properties

Define Workflow Elements

Use the following elements to define your workflow:

  • Start Event: Green circle indicating the starting point of the workflow.

  • Intermediate Events: Yellow circle for events that occur between the start and end points.

  • End Events: Red circle marking the end of the workflow.

  • Activities: Empty rectangle representing tasks or activities in the workflow.

  • Subprocess: Rectangle with a square for subprocesses.

  • Gateways: Diamond shape for decision points.

  • Lanes: Checklist icon to organize tasks by roles or departments.

  • Non-executable Items: 3D cube for items not executed within the workflow.

  • Miscellaneous: Engine icon for other workflow components.

Adjust Properties and Add Process Variables

  1. Create a start node with a script to initialize variables:

    System.out.println("New Hiring has been created for candidate: " + candidateData.getFullName());
    kcontext.setVariable("hr_approval", false);
    kcontext.setVariable("it_approval", false);
  2. Add an exclusive gateway for decision-making.

  3. Create a business rule task with specific properties and data assignments:

    System.out.println("###################################");
    System.out.println("Generated offer for candidate: " + candidateData.getFullName());
    System.out.println("Job Category: " + offer.getCategory());
    System.out.println("Base salary: " + offer.getSalary());
    System.out.println("###################################");
  4. Create and configure human tasks and boundary events:

    System.out.println("###################################");
    System.out.println("HR Interview have been avoided after reasonable time");
    System.out.println("###################################");
  5. Add scripts for various tasks and events to log important details and actions:

    System.out.println("###################################");
    System.out.println("To: " + candidateData.getEmail());
    System.out.println("Subject: Congratulations you made it!");
    System.out.println("Dear " + candidateData.getFullName() + ", we are happy to tell you that you've successfully went through the hiring process. You'll find the final Offer details in attached.");
    System.out.println("Job Category: " + offer.getCategory());
    System.out.println("Base salary: " + offer.getSalary());
    System.out.println("###################################");
    
    System.out.println("###################################");
    System.out.println("Candidate " + candidateData.getFullName() + " doesn't meet the requirements for the position but we'll keep it on records for the future!");
    System.out.println("###################################");

Using canvas to create a new project using accelerators

For information on setting up Developer Tools for VS Code see BAMOE Developer tools

  1. Open Canvas.

  2. Import hiring.bpmn (sample hiring BPMN file).

  3. Click Apply acceleratorQuarkus (Full), and on the pop-up click Apply.

    Process project with accelerator
    Figure 3. New process project with accelerator
  4. Click "Untitled Project" and rename the project. In this example, the project 1. is named process-service-sample

    Renaming project
    Figure 4. Renaming project
  5. In this step, for learning purposes, download the project to the local development environment by clicking on ShareAll files.

Note
Users with pre-configured git authentication can synchronize the new project on git and push it to a new repository.

Running the project locally with VSCode

With the process service now available in the local development environment, unzip the project. On a command line, the project can be extracted into a new folder with:

$ unzip process-service-sample.zip -d process-service-sample

Open the project process-service-sample using VSCode.

When using IBM BAMOE Developer Tools extension, developers can seamlesly interact with business assets directly from the developer IDE:

Project in VS Code
Figure 5. Project in VS Code

Notice the project includes the process definition and the application.properties file with generic sample configurations:

# Set up for the swagger-ui (Process-defintions)
quarkus.http.cors=true
quarkus.smallrye-openapi.path=/docs/openapi.json
quarkus.swagger-ui.always-include=true
kogito.generate.rest.decisions=true
kogito.generate.rest.processes=true

# list of users for task console
quarkus.kogito-runtime-tools.users=jdoe,admin,user
quarkus.kogito-runtime-tools.users.admin.groups=admin
quarkus.kogito-runtime-tools.users.user.groups=user
quarkus.kogito-runtime-tools.users.jdoe.groups=user,admin,IT,HR
kogito.service.url=http://localhost:8080
kogito.dataindex.http.url=http://localhost:8180
kogito.dataindex.ws.url=ws://localhost:8180

# Maximum Java heap to be used during the native image generation
quarkus.native.native-image-xmx=6g
kafka.bootstrap.servers=localhost:9092

## main transport

## metadata

#mp.messaging.outgoing.kogito-processinstances-events.bootstrap.servers=localhost:9092
mp.messaging.outgoing.kogito-processinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-processinstances-events.topic=kogito-processinstances-events
mp.messaging.outgoing.kogito-processinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
#mp.messaging.outgoing.kogito-usertaskinstances-events.bootstrap.servers=localhost:9092
mp.messaging.outgoing.kogito-usertaskinstances-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-usertaskinstances-events.topic=kogito-usertaskinstances-events
mp.messaging.outgoing.kogito-usertaskinstances-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer
#mp.messaging.outgoing.kogito-variables-events.bootstrap.servers=localhost:9092
mp.messaging.outgoing.kogito-variables-events.connector=smallrye-kafka
mp.messaging.outgoing.kogito-variables-events.topic=kogito-variables-events
mp.messaging.outgoing.kogito-variables-events.value.serializer=org.apache.kafka.common.serialization.StringSerializer

To execute the project in the local development environment, open a new terminal in VScode and execute:

mvn clean package
Opening a terminal in VS Code
Figure 6. Opening a terminal in VS Code

This command should compile and package the process service into a Quarkus executable Jar file. The resulting package is the service that can later be containerized and executed on cloud platforms. The process service generated using the accelerator brings in its pom.xml file a pre-configured set of add-ons. You will need to adapt this file to meet the requirements of your service.

The first execution will download the artifacts that are not yet available on the development environment