Featured image for Red Hat Process Automation.

This article is the first of two presenting new support for developing decision services in Red Hat Business Automation Manager and Red Hat Process Automation Manager. We specifically address support for the Decision Model and Notation (DMN) standard. Process Automation Manager now supports Kogito's cloud-native runtime engine for creating rules, decisions, and resource-planning optimization solutions based on the Predictive Model Markup Language (PMML).

We'll present an example using Kogito with Drools Rules Language, both backed by the KIE group. By expanding Kogito with the power of Quarkus, you can enjoy hot-reload during the development phase and compile decision services into fast, lightweight services.

For resource planning, Process Automation Manager 7.11 brings full support for OptaPlanner 8, the most recent version of this artificial intelligence (AI) constraint solver technology.

All these new features are now part of the Red Hat Process Automation stack. 

Decision services with Kogito

Kogito is the open source project that brings a new cloud-native runtime engine to Red Hat Decision Manager and Process Automation Manager. Kogito brings Drools and OptaPlanner's battle-tested capabilities with additional improvements for performance and usability. It provides a new set of tools that are better integrated with development IDEs such as Visual Studio Code (VS Code) and with versioning tools such as GitHub that are already helping developers create decision services more efficiently.

The Kogito decision engine generates 90% of the code you need to get your service up and running. Kogito code-gen uses DMN nodes and data types to infer domain-driven APIs that can be exposed via REST along with the inputs and outputs of the respective APIs, based on the Swagger specification.

Red Hat support for Kogito tools

To support the development of decision services, the KIE team provides you with a good set of tooling to use in different spaces. As of today, Red Hat supports the following tools:

Other community-provided tools, free for use, are backed by Red Hat and the KIE team:

  • Learn DMN in 15 minutes: A guided web-based tour through the elements of Decision Model and Notation.
  • GitHub Chrome Extension: A browser extension that allows you to visualize and edit BPMN, DMN, and test scenario files directly in GitHub.
  • Online Editors:
    • BPMN.new: A free online editor for business processes.
    • DMN.new: A free online editor for decision models.
    • PMML.new: A free online editor for scorecards.
  • Business Modeler Hub: Allows downloads of the VS Code Extension, GitHub Chrome extension, and desktop app.

With the VS Code Red Hat Business Automation extension, you can create new DMN diagrams by simply adding new files with the .dmn extension.

Kogito with Decision Model and Notation

Decision Model and Notation includes a TCK that allows vendors to check the conformity of their tooling. The DMN TCK test kit has three different levels of conformance, where Level 3 means that the tested tool provides all the capabilities required by the specification. Currently, the Kogito runtime is compliant with version 1.3, the most recent version of DMN, in conformance with Level 3.

The first Kogito engine version supported by Red Hat is Kogito 1.5.x, which is supported under Red Hat Process Automation version 7.11.x. You can choose to run your decision services on top of the Red Hat build of Quarkus 1.11.x or SpringBoot 2.3.4.

Creating a decision service with Kogito and Quarkus

To create your first decision service, use one of the available Kogito archetypes to generate the project for you. The following command generates a Quarkus-based decision service with the name sample-kogito:

$ mvn archetype:generate \
    -DarchetypeGroupId=org.kie.kogito \
    -DarchetypeArtifactId=kogito-quarkus-archetype \
    -DgroupId=org.acme -DartifactId=sample-kogito \
    -DarchetypeVersion=1.5.0.Final \
    -Dversion=1.0-SNAPSHOT

If you open the project in VS Code, you can already see a sample DMN created for you, as shown in Figure 1.

When you create a project using Kogito, it provides a sample DMN.
Figure 1: Sample DMN created by Kogito.

Notice there are no Java classes or POJOs in this project. You can run this project and check the exposed APIs by running the following command in your terminal:

$ mvn quarkus:dev

Once the project starts, you should see log messages similar to:

2021-05-26 09:59:49,581 INFO  [io.quarkus] (Quarkus Main Thread) sample-kogito 1.0-SNAPSHOT on JVM (powered by Quarkus 1.11.5.Final) started in 4.158s. Listening on: http://localhost:8080

2021-05-26 09:59:49,583 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.

2021-05-26 09:59:49,583 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, kogito-decisions, kogito-predictions, kogito-processes, kogito-rules, resteasy, resteasy-jackson, servlet, smallrye-health, smallrye-openapi, swagger-ui]

If the run is successful, you can access http//:localhost:8080/swagger-ui in your browser and check the existing APIs, as shown in Figure 2.

Kogito auto-generates RESTful APIs for the DMN.
Figure 2: RESTful APIs auto-generated by Kogito for DMN.

Conclusion

Creating and running cloud-native decision microservices is pretty straightforward when using Kogito. If you are interested in trying out Kogito decision services with DMN, here are some places you can go to get started:

If you are interested in how to run Drools Rules Language-based rules on Kogito, please refer to this article.

The Kogito community is pretty active. You can always reach out to other community members and the Red Hat team behind it through the community channels.

Last updated: January 22, 2024