restdroolskie-server

Is it possible to get insertLogical fact from REST or add custom REST url in drools 6.2?


I have a rule where in RHS I insertLogical another Fact. In Drools 6.2 we can deploy the rules in a container and then fire the rules on that container. When I run the POST request for fireAllRules(batch-execution), I can just get back the facts which I inserted. There seems to be no way to access the insertLogical Fact. Even the getObjects expects fact-handle and since I had not insert the fact there is no way to get it. Is there an option to get fact inserted in RHS?

Other option I thought of trying out was to add another REST url which I can expose from with-in container. This url can fire rule locally from within container and pass me back custom objects. Is this possible?


Solution

  • A simple solution for your situation could be to define a query in your DRL to return the logically-inserted fact. Using a BatchCommand you can then execute that query and get its result.

    Hope it helps,