Thanks for the swift reply!
I have configured my Knowledge Agent to reuse the same KnowledgeBase (set
drools.agent.newInstance property to "false" in my KnowledgeAgentConfiguration)
as described in the Expert documentation. But my stateful session keeps using the old
rules event though I can see from the log output that the Knowledgebase has been updated.
/Mattias
________
From: rules-users-bounces(a)lists.jboss.org [rules-users-bounces(a)lists.jboss.org] On Behalf
Of Esteban Aliverti [esteban.aliverti(a)gmail.com]
Sent: Monday, April 18, 2011 16:49
To: Rules Users List
Subject: Re: [rules-users] Dynamic updates of stateful sessions
By default, the Knowledge Agent creates a new kbase when changes in the monitored
resources are detected. So the stateful sessions you had are not going to "see"
the changes because they belong to a different kbase.
If you want the agent to apply the changes to the current kbase, you need to set
drools.agent.newInstance property to "false" in knowledge agent configuration.
You can read about this here:
http://ilesteban.wordpress.com/2010/03/25/knowledge-agent-incremental-cha...
If you are defining the kagent using spring, you can use the "newInstence"
attribute of <kagent> bean.
Best Regards,
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @
http://www.plugtree.com
- Blog @
http://ilesteban.wordpress.com
On Mon, Apr 18, 2011 at 11:41 AM, Mattias Avelin
<mattias.avelin@netlight.se<mailto:mattias.avelin@netlight.se>> wrote:
We have a application in which we have both stateless & stateful sessions
running. We're using the KnowledgeAgent and ChangeSets to automatically
update our knowledge bases when the rules are changed.
This works fine for our stateless sessions for which we are creating a new
session for each request and if the rules have been updated this is
reflected in next session we create.
But for stateful sessions I'm not quite as sure on how to get it working. I
can see in the logs that the KnowledgeBase is re-built when the
KnowledgeAgent detects the updated rule files. But my "long running" session
is does not reflect these changes (which it shouldn't right?). But how do we
apply these changes to the stateful session without loosing all the facts I
accumulated?
The way I've solved it now is to keep a "last updated" timestamp for the
knowledgeBase and a "created" timestamp for the session and then compare
these before using the session. If the knowledgeBase's "update timestamp"
is
later that the sessions "creation timestamp" I create a new Session and then
"manually" copy all facts from the former to the latter.
Is this the way you would do this or is there a better way?
Best Regards
Mattias Avelin
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org<mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit
http://www.messagelabs.com/email
______________________________________________________________________