droolsredhatkieredhat-brmsredhat-bpm

Is there a RESTful Interface for Executing DRL Business Rules via Red Hat's Process Automation Manager / KIE Decision Server?


I'm trying to set up a few basic "hello world" business rules using Red Hat's Process Automation Manager (7.10.0). There's a few ways to do this - DMN, Guided Decision Tables, Spreadsheets, DRL (Drools), etc. I'm mostly interested in evaluating "raw rules" rather than setting-up a "process" or making "decisions". For example, validating the format of a coordinate pair (latitude and longitude). As such, I'm opting for DRL rule definition for my initial use case.

Question: Once I define a DRL business rule, is there a way to test it via the Swagger UI RESTful service deployed with the KIE Server? This is easy enough to do with DMN or Guided Decision Tables, but all of the documentation surrounding execution of DRL rules requires writing a Client (like Java or Maven).


Solution

  • The answer is yes. In 7.10, deploy a container with your DRL rule(s) and then access the KIE Server Execution Docs (i.e. http://localhost:8080/kie-server/docs/).

    Then, navigate to the "KIE Session Assets" and POST to /server/containers/instances/{containerId}.

    Enter your container ID (i.e. rules_1.0.0-SNAPSHOT)

    And here's an example body:

    {
    "commands":[
      {
        "insert":{
          "object":{
            "Equipment":{
              "eqpId":230
            }
          },
          "out-identifier":"equipment"
        }
      },
      {
        "fire-all-rules":{
        }
      }
    ]
    }