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.<div>
If you want the agent to apply the changes to the current kbase, you need to set <span class="Apple-style-span" style="border-collapse: collapse; color: rgb(0, 0, 255); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; font-size: 11px; line-height: 14px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">drools.agent.newInstance </span>property to "false" in knowledge agent configuration.</div>
<div>You can read about this here: <a href="http://ilesteban.wordpress.com/2010/03/25/knowledge-agent-incremental-change-set-processing-and-binary-diff/">http://ilesteban.wordpress.com/2010/03/25/knowledge-agent-incremental-change-set-processing-and-binary-diff/</a></div>
<div><br></div><div>If you are defining the kagent using spring, you can use the "newInstence" attribute of <kagent> bean.</div><div><br></div><div>Best Regards,</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
</div><div>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">On Mon, Apr 18, 2011 at 11:41 AM, Mattias Avelin <span dir="ltr"><<a href="mailto:mattias.avelin@netlight.se">mattias.avelin@netlight.se</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
We have a application in which we have both stateless & stateful sessions<br>
running. We're using the KnowledgeAgent and ChangeSets to automatically<br>
update our knowledge bases when the rules are changed.<br>
This works fine for our stateless sessions for which we are creating a new<br>
session for each request and if the rules have been updated this is<br>
reflected in next session we create.<br>
<br>
But for stateful sessions I'm not quite as sure on how to get it working. I<br>
can see in the logs that the KnowledgeBase is re-built when the<br>
KnowledgeAgent detects the updated rule files. But my "long running" session<br>
is does not reflect these changes (which it shouldn't right?). But how do we<br>
apply these changes to the stateful session without loosing all the facts I<br>
accumulated?<br>
<br>
The way I've solved it now is to keep a "last updated" timestamp for the<br>
knowledgeBase and a "created" timestamp for the session and then compare<br>
these before using the session. If the knowledgeBase's "update timestamp" is<br>
later that the sessions "creation timestamp" I create a new Session and then<br>
"manually" copy all facts from the former to the latter.<br>
<br>
Is this the way you would do this or is there a better way?<br>
<br>
Best Regards<br>
<br>
Mattias Avelin<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br></div>