I think that is the minimum code needed to create a kagent with custom configuration.<div>The only line you could remove is:</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">kbase = kagent.getKnowledgeBase();</span><br clear="all">

<br></div><div>Because you are using incremental change-set processing (<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">drools.agent.newInstance</span> = false), you don&#39;t need to obtain a reference to the new kbase, because there is no new kbase. The agent will use the same kbase you provided.</div>

<div><br></div><div>If you don&#39;t want to use incremental change-set processing, then you must keep that line, and you could remove any reference to <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">KnowledgeAgentConfiguration.</span></div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><br></div><div>Best,</div><div><br>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">2010/8/23 Tina Vießmann <span dir="ltr">&lt;<a href="mailto:tviessmann@stud.hs-bremen.de">tviessmann@stud.hs-bremen.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">



  

    
  
  <div bgcolor="#ffffff" text="#000000">
    Hi,<br>
    <br>
    I want to create a KnowledgeBase using stream processing mode,
    getting its resources from an change-set xml and getting the updated
    when resources are changed. So far I&#39;m aware I need a KnowledgeAgent
    and a configuration for the kagent and the kbase. <br>
    My code is:<br>
    <blockquote>// create knowledge base<br>
      <br>
      // knowledge base configuration<br>
      KnowledgeBaseConfiguration kbaseConf =
      KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br>
      kbaseConf.setOption(EventProcessingOption.STREAM);<br>
      <br>
      // knowledge base<br>
      KnowledgeBase kbase =
      KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);<br>
      <br>
      <br>
      // create knowledge agent<br>
      <br>
      // create knowledge agent configuration<br>
      KnowledgeAgentConfiguration kagentConf =
      KnowledgeAgentFactory.newKnowledgeAgentConfiguration();<br>
      //enable incremental knowledge base build<br>
      kagentConf.setProperty(&quot;drools.agent.newInstance&quot;, &quot;false&quot;);<br>
      //create knowledge agent<br>
      KnowledgeAgent kagent =
      KnowledgeAgentFactory.newKnowledgeAgent(&quot;AITS CEP Engine Agent&quot;,
      kbase, kagentConf);<br>
              <br>
              <br>
      // apply change-set XML to knowledge agent<br>
kagent.applyChangeSet(ResourceFactory.newClassPathResource(&quot;changeset.xml&quot;));<br>
      <br>
      //  get updated knowledge base object<br>
      kbase = kagent.getKnowledgeBase();<br>
              <br>
      // create session<br>
      session = kbase.newStatefulKnowledgeSession();<br>
    </blockquote>
    <br>
    Can it be done in a more compact way?<br>
    <br>
    Thank you! :)<br>
    Tina<br>
  </div>

<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>
<br></blockquote></div><br></div>