Skip to content

Execute an IBM ODM Decision Service downloaded from a remote Rule Execution Server Console

License

Notifications You must be signed in to change notification settings

DecisionsDev/decisions-ruleapp-rest-loader

Repository files navigation

Execute an IBM ODM Decision Service downloaded from a remote Rule Execution Server Console

Build Status License

Follow us on slack

This Java SE sample illustrates how to execute a decision service downloaded from the ODM Rule Execution Server Console in Java SE with IBM Operational Decision Manager.

It makes use of:

The sample architecture and workflow are as follows:

Sample Architecture and Workflow

  1. The ODM RES Console Management REST API is invoked from the application's code to retrieve a RuleApp containing the ruleset to execute from the remote RES Console.
  2. On the RES Console side, the REST API asked the RuleApp management service for the target ruleset.
  3. A RuleApp containing the ruleset to execute is retrieved from the RES Console's RuleApp repository
  4. The REST API returns this RuleApp and makes it available to the application.
  5. The Java Rule session API is used to manage RuleApps and execute rulesets within the scope of the JSE application.
  6. The RuleApp downloaded in step 4. is added to the RES memory persistence.
  7. The Rule Session API delegates the ruleset execution to the RES Execution Unit (XU).
  8. The XU fetches the ruleset from the RES memory persistence .
  9. The XU retrieves the Java Execution Object Model (XOM) from the application classloader.
  10. The XU finally executes the ruleset and passes the available output results to the Rule Session API.

Pre-requisites

First, you'll need IBM Operational Decision Manager, version 8.9.2 or higher.

Finally, as the executed ruleset is downloaded from the RES console web application, you'll have to:

  1. Deploy the RuleApp containing the ruleset to an existing RES console.
  2. Provide the RES Console URL and its credentials so that the RES Console Management REST API can be appropriately invoked.

Defining the ODM 8.9.2 installation directory

To build and run this sample you'll need to set the ibm.odm.install.dir maven property so that it points to the actual location where ODM 8.9.2 is installed.

Deploying the RuleApp

The ruleset run by this sample is provided in the ruleapp/my-decision-service-1.0.jar RuleApp archive. Deploy this RuleApp archive to your target RES Console with your preferred deployment option, for instance:

  • By logging into the RES Console web application from a browser and then adding the RuleApp.
  • By invoking the RES Console Management REST API with cURL from the command line:
curl -v -X POST -H "Content-Type: application/octet-stream" --data-binary @./ruleapp/my-decision-service-1.0.jar -u <userName>:<password> <url>/apiauth/v1/ruleapps 

Where:

  • url is the RES Console URL. For instance, http://localhost:9080/res
  • userName and password are the credentials used to deploy the RuleApp with the RES Console Management REST API. For instance, respectively resAdmin and resAdmin.

Providing the RES Console URL and credentials

The RES Console URL and credentials should be made available in the RESConsole.json JSON file located at the root of the project's directory. Its expected structure is as follows:

{
	"url" : "<RES Console URL>",
	"userName" : "<user name>",
	"password" : "<password>"
}

Building

To build the source code, type the maven command:

mvn clean install -Dibm.odm.install.dir="<ODM_INSTALL_DIR>"

Running

  1. Make sure you have filled-in the RES Console URL and credentials in the RESConsole.json JSON file located at the root of the project's directory.
  2. Type the following maven command:
mvn exec:java -Dexec.mainClass="j2serulesession.RESConsoleSample" -Dexec.args="/test_deployment/loan_validation_with_score_and_grade" -Dexec.classpathScope="test" -Dibm.odm.install.dir="<ODM_INSTALL_DIR>"

License

Apache 2.0

Notice

© Copyright IBM Corporation 2018.

Build Status License