< Previous | Next >

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 that generates a RuleApp archive. The RuleApp contains a ruleset and the format that are expected 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

About this task

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

About this task

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

About this task

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 resAdmin 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

About this task

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 either web services, Enterprise JavaBeans (EJB), or Pure Old Java Objects (POJO).

Procedure

  1. Click Start > All Programs > package_group > Sample Server > Rule Execution Server Console.
    Tip: You can also enter http://localhost:<PORT>/res in a browser. Enter the correct port number for the URL.
  2. Sign in to the Rule Execution Server console by using resAdmin as the user name and password.
  3. Click the Explorer tab.
  4. In the Navigator, expand RuleApps, and then /my_deployment/1.0. (Rule Designer adds the underscore to the RuleApp name during deployment.)

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

    Image shows RuleApps in the Explorer tab.
  5. Click /my_operation/1.0 to view the details of the ruleset in the Ruleset View.

    The status of the ruleset is enabled, indicating that it can be run.

    Image shows that the ruleset is enabled for running.
  6. Click the Show Properties link to view the ruleset properties.

    The properties that you added in the previous step are set to true.

Step 5: Running the Miniloan web application with rules

About this task

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 selecting the Use Rules check box.

The validateWithJRules method of the Miniloan bean validates the rules.

Procedure

  1. Open a new browser window, and enter the following URL with the correct port number: http://localhost:<PORT>/miniloan-server
  2. Select the Use Rules check box.

    The check box activates the code that runs the ruleset. When you click Validate Loan, the Miniloan web application runs the rules that you deployed to Rule Execution Server. The behavior of Miniloan is the same, except that the business logic now relies on your rules.

  3. Click Validate Loan. The application shows the following message:
    Image shows Miniloan message.

    The Information section shows that the eligibility.minimum income rule was run in the rule task miniloan#eligibility.

    A rule is run when the conditions of the rule are met and the actions of the rule are triggered. This rule sets the approved status of the loan to false.

  4. Change the amount to 300000, and click Validate Loan again.

    You get the following response:

    Image shows Miniloan message.
  5. Close the Miniloan web application. You reopen it later to monitor the application.

(Optional) Step 6: Testing the HTDS description file

About this task

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, and click Retrieve HTDS Description File.
  2. Select the REST option, and then choose OpenAPI-JSON for the format.
  3. Click Test.
  4. 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
    }
    }
  5. Click Execute Request.
  6. The Server Response appears as follows:
    Image shows the server response.

What to do next

In the next task, you monitor a running ruleset.
< Previous | Next >