First step: Install Apache Maven. You can find instructions for doing so at the Apache Maven website.

Important

Due to https://github.com/quarkusio/quarkus/issues/31011, we recommend using the latest Apache Maven 3.8 version.

Using Apache Maven to Setup the Project

Next, we’ll create a project using the following steps:

  1. We’re going to create the service in Quarkus with the Maven commands below, this will create a Quarkus project called quick-kogito that will be versioned 1.0.0-SNAPSHOT including the extensions kogito-quarkus, dmn, resteasy-reactive-jackson, quarkus-smallrye-openapi, quarkus-smallrye-health which will create a Quarkus DMN project with the openapi components to get the OpenAPI end points easily with health checks when deploying to OpenShift.

    mvn io.quarkus:quarkus-maven-plugin:2.16.7.Final:create \
        -DprojectGroupId=com.ibm \
        -DprojectArtifactId=quick-kogito \
        -DprojectVersion=1.0.0-SNAPSHOT \
        -DplatformVersion=2.16.7.Final \
        -DplatformGroupId=io.quarkus.platform \
        -DplatformArtifactId=quarkus-bom \
        -Dextensions=kogito-quarkus,dmn,resteasy-reactive-jackson,quarkus-smallrye-openapi,quarkus-smallrye-health
  2. When you create this project you should get a bunch of Maven artifacts start to stream in your console that are being pulled and ultimately are left with a console message like the below:

    [INFO]
    [INFO] ========================================================================================
    [INFO] Your new application has been created in /Users/developer/quick-kogito
    [INFO] Navigate into this directory and launch your application with mvn quarkus:dev
    [INFO] Your application will be accessible on http://localhost:8080
    [INFO] ========================================================================================
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  24.548 s
    [INFO] Finished at: 2022-09-27T10:22:31-04:00
    [INFO] ------------------------------------------------------------------------
  3. Add the bamoe-bom, kogito-bom and bamoe-ilmt-compliance-quarkus-pamoe dependency into the pom.xml file.

    17        <surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
    18  +++   <kogito.bom.group-id>com.ibm.bamoe</kogito.bom.group-id>
    19  +++   <kogito.bom.artifact-id>bamoe-bom</kogito.bom.artifact-id>
    20  +++   <kogito.bom.version>9.0.0.Final</kogito.bom.version>
    21      </properties>
    
    ...
    28      <dependency>
    29  ---   <groupId>${quarkus.platform.group-id}</groupId>
    30  ---   <artifactId>quarkus-kogito-bom</artifactId>
    31  ---   <version>${quarkus.platform.version}</version>
    29  +++   <groupId>${kogito.bom.group-id}</groupId>
    30  +++   <artifactId>${kogito.bom.artifact-id}</artifactId>
    31  +++   <version>${kogito.bom.version}</version>
    32        <type>pom</type>
    33        <scope>import</scope>
    34      </dependency>
    
    ...
    
    77  +++   <dependency>
    78  +++     <groupId>com.ibm.bamoe</groupId>
    79  +++     <artifactId>bamoe-ilmt-compliance-quarkus-pamoe</artifactId>
    80  +++   </dependency>
    81      </dependencies>
  4. Build the project in the root folder:

    mvn clean package

    You will get some Maven stream once again, and at the end of it you should have:

    [INFO] Analysing decision tables in DMN Model 'pricing' ...
    [INFO]  analysis for decision table 'Base price':
    [INFO]   Decision Table Analysis of table 'Base price' finished with no messages to be reported.
    [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 3012ms
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  16.084 s
    [INFO] Finished at: 2023-06-28T14:22:02-03:00
    [INFO] ------------------------------------------------------------------------

Editing within VS Code

  1. Open the project in VS Code. From here we can see the workspace’s contents and if we expand the contents of /src/main you will see the creation of several artifacts. Within java you will have a GreetingResource.java and within resources you will have an application.properties and pricing.dmn file. These are sample files that can be later modified or deleted.

    VSCode Workspace Layout
  2. Install IBM BAMOE Developer Tools for VS Code. This gives you access to the visual editors for DMN and BPMN files. It also allows you to create and edit testing scenarios for project.

    IBM BAMOE Developer Tools for VS Code within the marketplace
  3. Let’s first click the pricing.dmn file to open it. When you do so you may be greeted with a message similar to This diagram does not have layout information. Click 'Yes' to compute optimal layout, it takes time according to the diagram size. Click 'No' to proceed without layout. Please save the layout changes once diagram is opened. - if so click Yes to automap the DMN locations.

    Automatic Layout
  4. When the diagram opens you will see something similar to below, so we will start exploring it. The DMN is made up of two inputs Age and Previous incidents?, which are used to make the decision, Base price.

    DMN First view
  5. If you click Age and then click the Properties icon on the right, you will open a pane for the input.

    DMN Properties
  6. Within this pane, you can see information about the input Age, this includes that it is a number and what the input name is. More can be changed around this object, including changing the color of the node, font size, etc.

    DMN Properties Expanded
  7. To view the Decision, click the square decision node and select the Edit button to enter the decision for Base Price.

    Edit DMN Decision
  8. From here you will see the Decision Table that is associated with the Base Price decision. From here you will see two (2) input columns (Age and Previous Incidents), as well as one output column (Base price) all with their types below them. These types are controlled from the properties panel similarly to how they were opened when looking at Age a few steps ago. This decision has 4 different rows that could fire, with a Hit Policy of UNIQUE signified by the U in the top left corner of the table. A decision writer could make any comments they want to the table and have them saved towards the decision here.

    Viewing DMN Decision

Create a GitHub repository for the project

One last thing we’re going to do is to create a GitHub repository for this service, so you have somewhere to store our changes and also take advantage of building it into a cloud service running on OpenShift.

  1. You can create a repository on GitHub. To do this login to your GitHub username (or create one if you don’t have one!) and from your home page and click the green New icon near the top left of the page (or you can navigate directly to here)

    New Repo
  2. Fill out the form with your values

    • Repository Name: quick-openshift-kogito

    • Select Public for now

    • Add a Description if you want

    • Click Create Repository

      Repo Form
  3. Create some content to add to your repository. GitHub has some recommendations, if you would like to follow them.

    Sample Command
  4. When this is done, you are finsihed with this section.