2011/4/20 Esteban Aliverti <esteban.aliverti@gmail.com>
@Wolfgang, maybe I need to update the documentation to explicitly inform about this behavior :).

Please do.
 
The agent doesn't make anything special to sync the sessions with the kbase. If you add a rule by hand to an existing kbase, all the session from this kbase will automatically detect the changes. 
Now I'm working in a helper class to create and apply change-set in a programatic way. So if you don't want kbases to be automatically modified when a resource chages, you can use this helper class.

There must be a way to avoid sudden changes in a running stateful session by KAgent "pushing" an updated KBase. Otherwise I don't think you can use KAgent without risks. Actually, I'd opt for a "pull" behavour" being the default with stateful session but it may be too late for that.

Cheers
Wolfgang


Best Regards,  

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com


2011/4/20 Wolfgang Laun <wolfgang.laun@gmail.com>
2011/4/20 Esteban Aliverti <esteban.aliverti@gmail.com>
@Wolfgang: if you are using drools.agent.newInstance=true (the default configuration), then whenever a change-set is applied, either because you explicitly force the agent to  do so, or because a monitored resource changes, the kbase inside the agent is thrown away an a new kbase is created. So you need to get the kbase from the agent and retrieve a fresh session from it.
You can confirm this behavior in this set of tests: https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/agent/KnowledgeAgentIncrementalChangeSetTest.java  
But, if you are using drools.agent.newInstance=false the internal kbase (and each stateful session you got from it) is refreshed when a change-set is applied.


Would you please point me to the doc where it says "and each stateful session ... is refreshed"?

If true, this were an extremely risky operation. Consider a stateful session whizzing along and - smack! - rules change right in the middle of a sequence of firings. Shudder.

-W




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users