[rules-users] how to use dynamic drl file in drools 6

Mark Proctor mproctor at codehaus.org
Sun Dec 15 14:51:05 EST 2013


Each update must be rebuilt and repackaged in a JAR - the JAR is our unit of deployment, and unit of update.

You can either rebuild that using the maven plugin, or you can rebuild it at runtime using the programmatic api. Either way make sure you remember to increase the version.
http://docs.jboss.org/drools/release/6.0.0.Final/drools-docs/html/KIEChapter.html#KIEExamplesSection
4.2.5.10. Programaticaly build a KieModule using Meta Models (how to build the jar)
4.2.5.6. Default KieSession from File  (how to load the jar at runtime)

One you have the jar, add it to the KieRepository. And then you can call 
KieContainer.updateToVersion( String ReleaseID )

If you are using kie-ci the jar can be placed in your local m2_repo, where it will be resolved automatically.

Note you cannot put jars on the class path, that you then want to dynamically update at runtime.

Mark
On 15 Dec 2013, at 08:55, merry0900 <m1e1r1r1y at 163.com> wrote:

> drools 6 has a great advance from drools5.
> I am a begginer of both drools 5 and drools6.
> My question is that I don't know how to impliment dynamic drl which means
> my drl(rule) file may change during the running of my app since in drools 6
> target a drl file like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <kmodule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns="http://jboss.org/kie/6.0.0/kmodule">
> 
>    <kbase name="HelloWorldKB" packages="org.drools.examples.helloworld">
>        <ksession name="HelloWorldKS"/>
>    </kbase>
> ....................
> 
> this file is located in src/main/resources/META-INF/kmodule.xml.
> And then the drl file will be packaged in the jar file. 
> 
> when i want to change my drl file, how can i do.  note:i don't want to
> rebuild my java source to jar.
> 
> for any help? thank you all,  from china.
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/how-to-use-dynamic-drl-file-in-drools-6-tp4027306.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list