Menu Close

Chapter 18. Migration of a PMML service to a Red Hat build of Kogito microservice

You can migrate PMML-based services to Red Hat build of Kogito microservices by moving the PMML resources from KJAR artifacts to the respective Red Hat build of Kogito project.

18.1. Major changes and migration considerations

The following table describes the major changes and features that affect migration from the KIE Server API and KJAR to Red Hat build of Kogito deployments:

Table 18.1. PMML migration considerations

FeatureIn KIE Server APIIn Red Hat build of Kogito artifact

PMML models

stored in src/main/resources of KJAR.

copy as is to src/main/resources.

Other configuration options

configured using a system property or kmodule.xml file.

only default values are considered and no override of configuration is supported.

Command-based REST API

use ApplyPmmlModelCommand to request PMML evaluation.

not supported.

Domain-driven REST API

not supported.

advanced support for PMML model-specific generation.

Note

The features that are not mentioned in the previous table are either not supported or not required in a cloud-native Red Hat build of Kogito deployment.

18.2. Migration strategy

The migration strategy includes the following steps:

  1. Migrate a KJAR that is deployed on the KIE Server to a Red Hat build of Kogito microservice.
  2. Deploy the Red Hat build of Kogito microservice using Red Hat OpenShift Container Platform.
  3. Modify the external application from client PMML API on the KIE Server to the REST API of the Red Hat build of Kogito deployment.

18.3. Migrating a PMML model KJAR to a Red Hat build of Kogito microservice

You can migrate a KJAR that is implemented using PMML model to a Red Hat build of Kogito microservice.

Procedure

  1. Create a Maven project for your Red Hat build of Kogito microservice.

    For the procedure about creating a Maven project, see Creating a Maven project for a Red Hat build of Kogito microservice.

    The Maven project creates Kogito artifacts.

  2. Copy the PMML models from the src/main/resources folder of the KJAR to the src/main/resources folder of the Kogito artifact.
  3. Run the following command to execute the Red Hat build of Kogito application:

    mvn clean install

    After running the Red Hat build of Kogito application, you can retrieve the Swagger or OAS specification file. The Swagger or OAS specifications provide the same information as the REST endpoint along with the following implementation details:

    • Base URL of the server where the API is available
    • References Schemas names

    You can use the provided implementation details when your external application is re-routed to the new URL.

After migrating a PMML model KJAR to a Red Hat build of Kogito microservice, you need to deploy the microservice using Red Hat OpenShift Container Platform. For deployment options with Openshift, see OpenShift deployment options with the RHPAM Kogito Operator.

18.4. Modifying an external application to a Red Hat build of Kogito microservice

After deploying the PMML microservice, you need to modify the external application to a Red Hat build of Kogito deployment.

Prerequisites

  • The original external application must be implemented on the KIE Server client API.

    Figure 18.1. Example external application implementation on KIE Server

    screen capture of the external application implementation on KIE Server

Procedure

  1. Remove all the usage of the KIE Server client API and replace it with the HTTP communication. The following is an example of a non-Java request:

    Example non-java request
  2. Ensure that any HTTP client Java library is used inside the external application to create a similar invocation and parse the result.

    The following is an example of Java 11 HTTP client and Gson to convert the input data to JSON:

    Example of Java 11 HTTP client
    Note

    All the parameters that are required as the values of the parameters are embedded in the URL that is called.