Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a git repo for your KRL rulesets and put it on Github. You can create a different repo for each ruleset if you like or create one repo and put multiple rulesets in it. 
  2. Create  file in your ruleset repo called hello.krl and put the following in it:

    Code Block
    themeConfluence
    languagejavascript
    ruleset hello_world {
      meta {
        name "Hello World"
        description <<
    A first ruleset for the Quickstart
    >>
        author "Phil Windley"
        logging on
        sharing on
        provides hello
    
      }
      global {
        hello = function(obj) {
          msg = "Hello " + obj
          msg
        };
    
      }
      rule hello_world is active {
        select when echo hello
        send_directive("say") with
          something = "Hello World";
      }
    
    }
  3. Use one of the methods in Tips for Developers to validate (parse) your ruleset.

    Info

    Installing and using the KRL command line parser can be a real time saver if you're going to be writing several rulesets. Checking in and trying to execute rulesets that don't parse is one of the primary frustrations of beginning KRL developers.

  4. Check your ruleset into Github. 

Registering Your Ruleset

Getting your parsed ruleset into Github is a great first step, but the rules engine doesn't know anything about it. Registering a ruleset gives it a Ruleset ID (RID) in the rules engine so that other users can install and run it. 

To register the ruleset, we will use the KRL Developer Tools at Pico Labs. 

Info

For information about creating an account and using the KRL Developer Tools, see the Developer Tools Tutorial.

When you click on the "Register Rulesets" menu item in the KRl Developer tools, you will see this page that shows all your registered rulesets and a menu item to register a new ruleset:

Image Added

When you click on "Register a new ruleset" you'll see this page:

Image Added

 

Registering Your Ruleset

...

You should enter the URL of the ruleset you saved in the last section. If you saved your ruleset in Github, ensure that you enter the raw URL. 

Info

A Github raw URL returns the file without any Github page chrome. For example, this is a raw and cooked example of the same ruleset.

After you press "Register Ruleset" you'll be returned to the list of registered rulesets. The ruleset you just registered should be in the list:

Image Added

Note that registering a ruleset creates both prod and dev versions of the RID which can be updated independently. You can use different RID versions to create a production copy and a development copy of the ruleset. 

The ruleset is now registered and ready for use. 

Installing the Ruleset

Flushing the Ruleset

Testing the Ruleset

Debugging the Ruleset

...