<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">I tried but it doesn't seem to work. I am using UrlResource for the KnowledgeAgent.<br><br>kagent.getKnowledgeBase().addEventListener(new foo());<br>ResourceFactory.getResourceChangeNotifierService().start();<br>ResourceFactory.getResourceChangeScannerService().start();<br><br>But when the package is rescan, foo seems to be gone as kagent rebuilds knowledgebase?<br><br><br><br><font color="#990099">-----rules-users-bounces@lists.jboss.org wrote: -----</font><div><blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:solid black 2px;margin-right:0px">To: Rules Users List <a class="moz-txt-link-rfc2396E" href="mailto:rules-users@lists.jboss.org">&lt;rules-users@lists.jboss.org&gt;</a><br>From: Wolfgang Laun <wolfgang.laun@gmail.com><br>Sent by: <a class="moz-txt-link-abbreviated" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>Date: 03/01/2012 05:21PM<br>Subject: Re: [rules-users] Adding change/event listener to package<br><br>As with all Listeners in Java, you write a class implementing the methods defined by the interface.&nbsp;The parameter types tell you about what is passed to the respective call.<br><br>class Foo implements KnowledgeBaseEventListener {<div> <div>&nbsp; &nbsp; public void afterRuleAdded(AfterRuleAddedEvent event){</div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; if( "WatchedPackage".equals( event.getRule().getPackageName() ){</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div> <br></div><div>&nbsp; &nbsp; //...</div><div>}</div><div><br></div><div>A new Foo is attached to the kSession object - that's all.</div><div><div><br></div><div>-W</div><div><br>2012/3/1 Jian Feng Ng &lt;<a href="mailto:jng42@csc.com">jng42@csc.com</a>&gt;:<br> &gt; I saw many interfaces, but the problem is I do not know how to 'use' them.<br>&gt; Is there a tutorial or example codes somewhere?<br>&gt;<br>&gt;<br>&gt;<br>&gt; -----<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> wrote: -----<br> &gt;<br>&gt; To: Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>&gt; From: Wolfgang Laun<br>&gt; Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br> &gt; Date: 03/01/2012 04:38PM<br>&gt; Subject: Re: [rules-users] Adding change/event listener to package<br>&gt;<br>&gt; See the javadoc on a lot of interfaces in org.drools.event.knowledgebase.<br>&gt; The expert manual has a section on the "Event Model" showing how to attach a<br> &gt; listener to the knowledge session (not a package).<br>&gt; -W<br>&gt;<br>&gt;<br>&gt;<br>&gt; 2012/3/1 Jian Feng Ng &lt;<a href="mailto:jng42@csc.com">jng42@csc.com</a>&gt;<br>&gt;&gt;<br>&gt;&gt; I wish to add a listener to a package, so that my application can do<br> &gt;&gt; something else when there is any creation or deletion of rules in the<br>&gt;&gt; package. May I know how can I do this?<br>&gt;&gt;<br>&gt;&gt; _______________________________________________<br>&gt;&gt; rules-users mailing list<br> &gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> &gt;&gt;<br>&gt;<br>&gt; _______________________________________________<br>&gt; rules-users mailing list<br>&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> &gt;<br>&gt;<br>&gt;<br>&gt; CSC&nbsp;•&nbsp;Please consider the environment before printing this e-mail.<br>&gt;<br>&gt; This is a PRIVATE message. If you are not the intended recipient, please<br>&gt; delete without copying and kindly advise us by e-mail of the mistake in<br> &gt; delivery. NOTE: Regardless of content, this e-mail shall not operate to bind<br>&gt; CSC to any order or other contract unless pursuant to explicit written<br>&gt; agreement or government initiative expressly permitting the use of e-mail<br> &gt; for such purpose&nbsp;•&nbsp;CSC Technology Singapore Pte. Ltd. • Registered Office:<br>&gt; 20 Anson Road, #11-01 Twenty Anson Singapore 079912 • Registered in<br>&gt; Singapore No: 198400958N<br>&gt; _______________________________________________<br> &gt; rules-users mailing list<br>&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br> &gt;<br><br></div></div> <font size="2" face="Courier New,Courier,monospace">_______________________________________________<br>rules-users mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></font></wolfgang.laun@gmail.com></blockquote></div><span><br><br><span style="font-size: 13px; font-weight: bold;">CSC</span><span style="font-size: 10px;">&nbsp;•&nbsp;</span><span style="font-size: 10px">Please consider the environment before printing this e-mail.<br><br>This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery.  NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose</span><span style="font-size: 10px;">&nbsp;•&nbsp;</span><span style="font-size: 10px; font-style: italic;">CSC Technology Singapore Pte. Ltd. • Registered Office: 20 Anson Road, #11-01 Twenty Anson Singapore 079912 • Registered in Singapore No: 198400958N</span></span></font>