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( "WatchedPackage".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's all.</div><div><div><br></div><div>-W</div><div><br>2012/3/1 Jian Feng Ng <<a href="mailto:jng42@csc.com">jng42@csc.com</a>>:<br>
> I saw many interfaces, but the problem is I do not know how to 'use' them.<br>> Is there a tutorial or example codes somewhere?<br>><br>><br>><br>> -----<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> wrote: -----<br>
><br>> To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>> From: Wolfgang Laun<br>> Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>
> Date: 03/01/2012 04:38PM<br>> Subject: Re: [rules-users] Adding change/event listener to package<br>><br>> See the javadoc on a lot of interfaces in org.drools.event.knowledgebase.<br>> The expert manual has a section on the "Event Model" showing how to attach a<br>
> listener to the knowledge session (not a package).<br>> -W<br>><br>><br>><br>> 2012/3/1 Jian Feng Ng <<a href="mailto:jng42@csc.com">jng42@csc.com</a>><br>>><br>>> I wish to add a listener to a package, so that my application can do<br>
>> something else when there is any creation or deletion of rules in the<br>>> package. May I know how can I do this?<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>><br>><br>> CSC • Please consider the environment before printing this e-mail.<br>><br>> This is a PRIVATE message. If you are not the intended recipient, please<br>> delete without copying and kindly advise us by e-mail of the mistake in<br>
> delivery. NOTE: Regardless of content, this e-mail shall not operate to bind<br>> CSC to any order or other contract unless pursuant to explicit written<br>> agreement or government initiative expressly permitting the use of e-mail<br>
> for such purpose • CSC Technology Singapore Pte. Ltd. • Registered Office:<br>> 20 Anson Road, #11-01 Twenty Anson Singapore 079912 • Registered in<br>> Singapore No: 198400958N<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br><br></div></div>