[rules-users] Dynamic rules in Drools 6

Davide Sottara dsotty at gmail.com
Thu Jan 23 11:19:54 EST 2014


There may be some misunderstanding here..
you can indeed rebuild the jar, but there is also a programmatic
way to add (DRL) resources to an in-memory FS and update
the KBs/KSs on the fly. See the examples in IncrementalCompilationTests
Davide

On 01/23/2014 10:11 AM, Mark Proctor wrote:
> On 23 Jan 2014, at 16:02, jhusby <husby024 at umn.edu> wrote:
>
>> Looking at the test case from Edson, quoted below, it appears that there's no
>> way to reuse a current session when upgrading the kbase rules?  I need to
>> add and remove rules on the fly, and so if I have a stateful session, does
>> this mean I need to dispose of the current session, upgrade the container,
>> create a new session, and repopulate it with all my objects? 
>>
>> I was hoping to simply rebuild the repository, call
>> kContainer.updateToVersion(), and have the the session (with all my objects
>> still populated) automatically use that new version of the rules repository. 
>> Is this not possible? 
>>
> yes,this is how it works now. Make sure you build the jar with the maven plugin, so that it can performance the incremental diff. We have a number of low level unit tests, that show this should work. If you have found a bug, please update the test class here:
> https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java
>
> Mark
>
>
>> Thanks, 
>> Joseph 
>>
>>
>>> Edson Tirelli-4 wrote
>>> Here is a code example of creating kie modules in memory and upgrading 
>>> existing kbases/ksessions: 
>>>
>>> https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java#L106
>>>
>>>   It is a test case, but maybe it will be easier to follow. We are
>>> working 
>>> on additional ways of doing similar things as well. 
>>>
>>>   Edson
>>
>>
>>
>>
>> --
>> View this message in context: http://drools.46999.n3.nabble.com/Dynamic-rules-in-Drools-6-tp4027833.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
>
> _______________________________________________
> 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