Task 5: Deploying and running your ruleset

You deploy your ruleset to Rule Execution Server, and run it in the Miniloan application.

About this task

You start by creating a deployment configuration. It generates a RuleApp archive that contains a ruleset to be run by Rule Execution Server. The ruleset is packaged in a JAR file that includes everything to run the ruleset, including the rules and the ruleflow.

After you create the deployment configuration, you use the Miniloan web application to run your new business logic in Rule Execution Server.

Graphic presentation of the deploying process

You can also test your deployed ruleset by using a hosted transparent decision service (HTDS). After you deploy the RuleApp to Rule Execution Server, you can generate a Web Services Description Language (WSDL) file from your ruleset, and then test the file in Rule Designer.

Step 1: Creating a deployment configuration

To deploy your rules from Rule Designer, you must create a deployment configuration.

Procedure

  1. Ensure that the sample server is started (see Starting the Miniloan web application).
  2. If you are still in the Operation Map, click return to decision service map.
  3. In the Decision Service Map view, click Create deployment configuration.
    Tip: You can also click File > New > Deployment configuration.
  4. In the New Deployment Configuration wizard, browse to and select the deployment folder my decision service/deployment, and in the Name field, type my deployment.
  5. Click Finish.
    The editor displays an error message because the deployment configuration does not reference an operation yet.
  6. Open the Decision Operations tab.
  7. In Configured Decision Operations, click the Add "" button. Ensure that Select existing decision operations is selected, and then expand my decision service and select my operation.
  8. Click Finish.

Step 2: Enabling ruleset monitoring

You enable the monitoring of the ruleset for when it runs.

Procedure

  1. Select my operation in Configured Decision Operations.
  2. In the Ruleset Properties, click the Add "" button to add a property.
  3. In the Name field, type ruleset.bom.enabled, and in the Value field, type true.
  4. Click OK to create a new property for the ruleset.
  5. Repeat steps 1 to 4 to define the properties monitoring.enabled and ruleset.sequential.trace.enabled. Set the values of these properties to true.
  6. Save the changes. You must save your changes before you can deploy the RuleApp.

Step 3: Deploying the ruleset

You deploy the ruleset from Rule Designer to Rule Execution Server.

Procedure

  1. In the Ruleset Version Policy section, ensure Increment minor version numbers is selected.
  2. Click the Target Servers tab and click the Add "" button to define a new target server.
  3. In the Target Server wizard, ensure Create a Rule Execution Server connection is selected and click Next.
  4. In the Name field, type Sample server. In the URL field, enter the following address: http://localhost:<PORT>/res.
    Enter the correct port number in the URL (see Checking the server port number).
  5. Enter odmAdmin as the user name and password.
    You do not have to select Save my login information.
  6. Click Test Connection. Check that the connection succeeded, and then click Finish.
  7. Save your work.
  8. Open the Overview tab, and click Proceed to RuleApp deployment in the Deployment section.
    Important: When you deploy a RuleApp from the Samples Console, you get a message to use the same JDK for Rule Designer and the application server. The same JDK is used for the Samples Console and the sample server.
  9. Select my operation and verify the deployment summary. Click Next.
  10. Check the credentials and click Next.
  11. Check the version summary and click Finish. The Deployment report opens and shows that the deployment was successful.

Step 4: Viewing the deployed RuleApp

You view the deployed RuleApp in Rule Execution Server, which is the rule execution environment that has the rule engine. Rule Execution Server handles the management, performance, security, and logging capabilities that are associated with the execution of your rules. From your application, you access Rule Execution Server by using REST API, web services or Pure Old Java Objects (POJO).

Procedure

  1. Start the Rule Execution Server console (see Opening the Rule Execution Server console on the sample server).
  2. Sign in to the Rule Execution Server console by using odmAdmin as the user name and password.
  3. Click the Explorer tab.
  4. In the navigation tree, click my_deployment.

    You see that Rule Execution Server contains version 1.0 of my_deployment, which contains version 1.0 of the my_operation ruleset.

  5. Click my_operation to view the details of the ruleset in the ruleset view.

    The ruleset window shows the properties that you added in the previous step. The status of the ruleset is enabled.

Step 5: Testing the HTDS description file

A hosted transparent decision service (HTDS) is a web service that provides an interface to access a deployed ruleset. The transparent decision service component passes input parameters to the rule engine and accesses the return values. The transparent decision service support includes traceability from transparent decision services to rules, runtime monitoring, and version management. You test the REST execution of the my_operation ruleset from the Rule Execution Server console.

Procedure

  1. In the Rule Execution Server console, ensure that you are still on the my_operation ruleset page. In the Hosted Transparent Decision Services (HTDS) Options section, click Retrieve HTDS Description File.
  2. Select the REST option, and then choose JSON for the format.
  3. Click Test.
  4. Select JSON in the Execution Request menu.
  5. On the REST Service page, replace the entire request description with the following text:
    {  
    "loan": {    
    "amount": 8000,    
    "duration": 12  
    },  
    "__DecisionID__": "Test",  
    "borrower": {    
    "name": "John",    
    "creditScore": 100,    
    "yearlyIncome": 70000
    }
    }
  6. Click Execute Request. The Server Response shows the results.

Step 6: Running the Miniloan web application with rules

In the Miniloan web application, you can choose whether the business logic that is embedded in the application is pure Java code or coded in a ruleset. The first time that you started the Miniloan application, you did not have the ruleset, so you ran the application by using the Java code. You can now use your deployed ruleset in Rule Execution Server by setting the execution mode.

Procedure

  1. Open a new browser window, and enter the following URL with the correct port number: http://localhost:<PORT>/miniloan-server
    Image shows the Miniloan sample application.
  2. Click Server to expand the execution part.
    Image shows the execution part.
  3. Select Use Rules to use the deployed ruleset.

    Look at the parameters:

    • Server shows the URL to access Rule Execution Server by using User and Password as login credentials.
      Note: Because the sample server uses HTTP, login credentials are not required.
    • Ruleset shows the names of the RuleApp and the ruleset.
    • Selecting Trace enabled can show you more information on the execution.
  4. Click Request loan without changing the default parameters. The application shows the following message:
    Image shows trace information.

    The loan is rejected because the debt-to-income ratio is too big.

  5. Select Trace enabled to get more information on the execution.
  6. Click Request loan.
    The trace shows that one rule was executed: eligibility.minimum_income.
  7. Change the amount to 2000000 and validate again.
    The loan is rejected, and one rule was executed: validation.maximum_amount.
  8. Close the Miniloan web application.

What to do next

In the next task, you monitor a running ruleset.