0 Replies Latest reply on Aug 14, 2015 5:12 AM by hotteelink

    Next step - How to actually use/call the deployed project?

    hotteelink Newbie



      I have trouble finding a way how to actually utilize the BRMS project I created. I have BRMS 6.1. I have created a bunch of fact classes, packaged them into a jar and uploaded it to BRMS artifact repository. Then I have created a project in BRMS, added my facts.jar as dependency. I have created some rules utilizing those facts. Then I have done Build & Deploy on the project. Then in the Deploy, Rule Deployments I have registered a local kie-server (Decision/Execution) server. Then I have created a new container on that server which contains my deployed project.


      All this is described more less fine in the BRMS and Drools documentation, but this is also where it ends. I need to know how to take the next step, how to actually utilize what I have done so far. I have about 10000 fact instances (records) which I need to insert into the working memory/session. Then I need to execute those rules and then inspect the facts for the results. How to do that?


      So far my understanding is that there are at least two ways.


      1) Using the REST API of the Execution server.

      Here is a problem how to actually insert those 10000 records. I found that it might be possible using POST on /containers/{id} using an InsertElementsCommand to upload data in XML format. Do I have to send all those megabytes of data using the XML over the wire? This doesn't seem to be usable for productive use with my amount of records.

      Then I probably need to call FireAllRulesCommand. Then I can probably use the GetObjectsCommand to read the results. Could somebody confirm this is the intended way of working with Execution server? I would rather much more like a command like ExecuteInternalCode (which doesn't exist) which would call a method on already deployed class. This way I could load all my 10000 records from database or something and feed it to the session much more effectively. This could even write my results into some xml on filesystem. Is this possible, how?


      2) From a secondary webapp

      I have seen a CoolStore example which works in this way. In this case I suppose the Execution server is not needed at all. One creates a web application and deploys it on the same EAP where the BRMS is. In the web app one can have a controller with an action triggered any way (REST, button etc). In this code one can load his fact data from database, insert it into a session, fire all rules and inspect results, all written in his action code. One has to make sure when creating KieBase/Session to use the correct groupId/artifactId/version combo so that it finds his deploy BRMS project correctly (how and that it even works this way is again not documented).

      Do I really need to write a web application to utilize the BRMS when I don't need any web application per se?


      3) Are there any other ways?


      Please fill my gaps and correct my assumptions. I'm sure many people would also appreciate an insight into the next step. This information should be available in the documentation. Thank you and appreciate any answers.