Is it possible to reload/change rules without recompilation?

3,112 views
Skip to first unread message

bianca....@insight-centre.org

unread,
Jan 4, 2017, 8:57:42 AM1/4/17
to Drools Usage
Hello,

  I am new using Drools and I have a question you could maybe help me with.

  I would like to know if I can change the rules in the system without having to recompile, but still persisting the rules.

  I am currently importing the kie-ci 6.1.0.Final (although I do not currently have any constraint on the version to use) in my project using Maven. I am also using Spring Boot if it makes any difference.

  What I have been doing
   
   1 - I create the DRL rules in a separate file.
   2 - Create the XML configuration.
   3 - Run mvn package
   4 - Deploy the jar file.

  If I want to change any rule I need to change the DRL, stop the current jar, package again and redeploy.

  Other options

   A) I saw in the documentation that there is a way to use an Mvel Template and use a Spreadsheet with the data. (https://docs.jboss.org/drools/release/6.5.0.Final/drools-docs/html_single/index.html#d0e5713)

    It seems this option also requires that both the template and the spreadsheet are available before packaging and deployment. In other words, I will need to recompile anyway.

  B) There are many available interfaces in the Drools Workbench to help users to create rules. I supposed these interfaces use a mechanism to reload the rules rather than having to go through recompilation. (https://docs.jboss.org/drools/release/6.5.0.Final/drools-docs/html_single/index.html#drools.AuthoringAssets)

    I seem mistaken because the Workbench REST API also has mvn calls of the following type:


  C) It seems there is another way to create rules programatically (http://blog.athico.com/2014/07/drools-executable-model.html) but I am not sure there is a standard procedure to persist them (or if I need to do it on my own).


  Any thoughts or directions you could point me on this problem?

  
 Best Regards,
 Bianca

Edson Tirelli

unread,
Jan 4, 2017, 4:03:14 PM1/4/17
to drools...@googlegroups.com

   Bianca,

   Drools works with versioned jars (called kjars) as it unit of deployment, so you always need to have a jar in order to deploy rules. Having said that, this jar can be created in memory and dynamically updated without having to go through the cycle you described. You can even update a running kie-container with a new kjar without stopping the application.

   Here is a helper class you can use to create kjars in memory:


   Edson


--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage+unsubscribe@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/19a0128c-38f9-48f2-aaf0-9ce8535135f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
  Edson Tirelli
  Sr Principal Software Engineer 
  Red Hat Business Systems and Intelligence Group

bianca....@insight-centre.org

unread,
Jan 5, 2017, 5:24:26 AM1/5/17
to Drools Usage
Hello Edson,

  Thanks a lot for your answer. I will test this option.

  Best,
  Bianca
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/19a0128c-38f9-48f2-aaf0-9ce8535135f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jesús Joaquín Martínez Molina

unread,
Feb 22, 2018, 4:20:13 AM2/22/18
to Drools Usage
Hello Bianca and Edson

I have to develop the same. I have an application and it's possible to modify in real time the DRL file with my rules. How I can use this KieHelper.java class to do it??

Thanks in advance
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/19a0128c-38f9-48f2-aaf0-9ce8535135f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages