Question

I have a simple use case of the Drools Expert KnowledgeAgent. I'm using Drools 5.3.0.Final and my rules are already compiled in Guvnor 5.3.0.Final.

My changeset xml file looks like the following:

   <add>
       <resource type="PKG" source="http://ssmdeoasd01.susalud.com:7777/drools-guvnor/org.drools.guvnor.Guvnor/package/co.com.sura.seguros.adultomayor.consultas/LATEST"/>
   </add>

Tha PKG contains rules from a single simple DTABLE.

When I change the DTABLE and upload it to Guvnor (while the app is still running), Drools Expert indeed identifies the change, but do not apply it. The console looks like the following:

Compilando reglas ...
Reglas compiladas ...
Tiempo de compilacion de reglas: 0 ms
Obteniendo manager ...
Manager obtenido ...
Obteniendo sesión de conocimiento ...
listKnowledgePackages.size(): 1
Sesión de conocimiento obtenida ... 
3 Padre
2 Hermanos
1 Conyuge
[2013-01-16 15:54:17,670:debug] ResourceChangeScanner attempt to scan 1 resources
[2013-01-16 15:54:17,684:debug] ResourceChangeScanner modified resource=[UrlResource path='http://ssmdeoasd01.susalud.com:7777/drools-guvnor/org.drools.guvnor.Guvnor/package/co.com.sura.seguros.adultomayor.consultas/LATEST'] : 1358369287000 : 1358369637000
[2013-01-16 15:54:17,684:debug] ResourceChangeNotification received ChangeSet notification
[2013-01-16 15:54:17,684:debug] ResourceChangeScanner thread is waiting for 60 seconds.
[2013-01-16 15:54:17,684:debug] ResourceChangeNotification processing ChangeSet
[2013-01-16 15:54:17,684:debug] ResourceChangeNotification ChangeSet modified resource=[UrlResource path='http://ssmdeoasd01.susalud.com:7777/drools-guvnor/org.drools.guvnor.Guvnor/package/co.com.sura.seguros.adultomayor.consultas/LATEST'] for listener=org.drools.agent.impl.KnowledgeAgentImpl@10655dd
[2013-01-16 15:54:17,686:debug] ResourceChangeNotification thread is waiting for queue update
Compilando reglas ...
Reglas compiladas ...
Tiempo de compilacion de reglas: 0 ms
Obteniendo manager ...
Manager obtenido ...
Obteniendo sesión de conocimiento ...
listKnowledgePackages.size(): 1
Sesión de conocimiento obtenida ... 
3 Padre
2 Hermanos
1 Conyuge

Even though the KnowledgeAgent identifies the change, the rule keep compiled the same and no changes are reflecte in the result.

I have no particular configuration for the KnowledgeAgent nor specific extensions. I have used the default listeners and so instead.

Why is this happening?

Was it helpful?

Solution

I was making a mistake.

I was building the agent with an existing KnowledgeBase. Then when the agent was instantiated I was obtaining the base from that agent and keeping a reference to that base in order to always obtain a session from that base. I thought that if the base in the agent changed, then my base -which was obtained from the agent- changed too.

Then, when the rules changed in Guvnor, the agent indeed did its job and recreated its KnowledgeBase but because of the fact that I was always referencing the base obtained immediately after the agent instantiation and getting a session from that old KnowledgeBase then the rules executed were those in the old base.

The references are ok now and the changes in the rules are reflected in the execution :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top