Updated on 2024-11-29 GMT+08:00

Adding a Decision Engine

Scenario

RTDService supports Drools-based decision engine scoring. Service managers can import decision engine files to the RTD platform to use decision engine to calculate real-time message data and generate decision scores.

Procedure

  1. Log in to the RTD web UI as a service user and select a tenant. For details, see Accessing the RTDService Web UI.
  2. Choose Business Management > Decision Engine.
  3. Click Add and set the required parameters by referring to the following table.

    Table 1 Parameters for adding a decision engine

    Parameter

    Description

    Event Source Type

    Event source type corresponding to the decision engine

    Name

    Decision engine name

    File Path

    Path of the decision engine file. Upload a file.

    Data File Testing

    Path of the test file. Upload a test file.

    Description

    Description of the decision engine

    Click Check to check the validity of the decision engine file and run the decision engine for test.

    If the engine fails the check, modify the decision engine file as prompted and perform the check again.

  4. After the check is passed, click OK.

    You can bring the decision engine online or take it offline on the page.

    • Before creating a decision engine, bring the event source of the decision engine online.
    • The DRL file referenced by the decision engine is case sensitive. If the DRL file in the decision engine file references a specific stored procedure rule name, all English letters in this name must be lowercase letters. For example, pr_RULE must be converted to pr_rule.
      • The following is a negative example:
        function double compute (Map computeResults, Set metaDataSet, StringBuffer extender) {
           double score1 = getRuleScore(computeResults,"pr_RULE1");
           double score2 = getRuleScore(computeResults,"pr_RULE2");
        
           return score1 + score2;
        };
      • The following is a positive example:
        function double compute (Map computeResults, Set metaDataSet, StringBuffer extender) {
           double score1 = getRuleScore(computeResults,"pr_rule1");
           double score2 = getRuleScore(computeResults,"pr_rule2");
        
           return score1 + score2;
        };