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, it is recommend to use the latest Apache Maven 3.8 version. |
Using Apache Maven to Setup the Project
Next, we’ll create a project using the following steps:
-
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 versioned1.0.0-SNAPSHOT
including the extensionskogito-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
-
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] ------------------------------------------------------------------------
-
Add the
bamoe-bom
,kogito-bom
andbamoe-ilmt-compliance-quarkus-pamoe
dependency into thepom.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>
-
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
-
Open the project in VS Code. From here you can see the workspace’s contents and if you expand the contents of
/src/main
you will see the creation of several artifacts. You can findGreetingResource.java
file withinjava
andapplication.properties
andpricing.dmn
file withinresources
These are sample files that can be later modified or deleted. -
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.
-
Let’s first click the
pricing.dmn
file to open it. When you do so you may be greeted with a message similar toThis 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. Save the layout changes once diagram is opened.
- if so clickYes
to automap the DMN locations. -
When the diagram opens you will see something similar to below, so you can start exploring it. The DMN is made up of two inputs Age and Previous incidents?, which are used to make the decision, Base price.
-
If you click Age and then click the Properties icon on the right, you will open a pane for the input.
-
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, and so on.
-
To view the Decision, click the square decision node and select the
Edit
button to enter the decision for Base Price. -
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
andPrevious 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 atAge
a few steps ago. This decision has 4 different rows that could fire, with a Hit Policy ofUNIQUE
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.
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.
-
You can create a repository on GitHub. To do this login to your GitHub username (or create one if you do not 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) -
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
-
-
Create some content to add to your repository. GitHub has some recommendations, if you would like to follow them.
-
When this is done, you are finsihed with this section.