As with all Listeners in Java, you write a class implementing the methods defined by the interface. The parameter types tell you about what is passed to the respective call.<br><br>class Foo implements KnowledgeBaseEventListener {<div>
<div>    public void afterRuleAdded(AfterRuleAddedEvent event){</div></div><div>        if( &quot;WatchedPackage&quot;.equals( event.getRule().getPackageName() ){</div><div><br></div><div>        }</div><div>    }</div><div>
<br></div><div>    //...</div><div>}</div><div><br></div><div>A new Foo is attached to the kSession object - that&#39;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 &#39;use&#39; 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 &quot;Event Model&quot; 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 • 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 • 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>