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 &quot;see&quot; 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, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace; font-size: 11px; line-height: 14px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">drools.agent.newInstance </span>property to &quot;false&quot; 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 &quot;newInstence&quot; attribute of &lt;kagent&gt; 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">&lt;<a href="mailto:mattias.avelin@netlight.se">mattias.avelin@netlight.se</a>&gt;</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 &amp; stateful sessions<br>
running. We&#39;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&#39;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 &quot;long running&quot; session<br>
is does not reflect these changes (which it shouldn&#39;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&#39;ve solved it now is to keep a &quot;last updated&quot; timestamp for the<br>
knowledgeBase and a &quot;created&quot; timestamp for the session and then compare<br>
these before using the session. If the knowledgeBase&#39;s &quot;update timestamp&quot; is<br>
later that the sessions &quot;creation timestamp&quot; I create a new Session and then<br>
&quot;manually&quot; 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>