Yes sometimes the "audit trail" of rule firing could be part of your model
itself (this is how I have always preferred it in the past).

On 2/9/06, 宋宇彬 <[EMAIL PROTECTED]> wrote:
>
>
> further more,the execute result of every rule  is concerned by the
> business analyst
> To jrules, this problem is headled by adding a result class to the bom,
> set the result object every time firing the rule,and record the execute
> result of the rule
> u can persist the result in audit log or db for using by the analyst tools
>
> -----邮件原件-----
> 发件人: Jaime Saiz Santos [mailto:[EMAIL PROTECTED]
> 发送时间: 2006年2月9日 17:00
> 收件人: [email protected]
> 主题: RE: [drools-user] how to know which rule was fired?
>
> Of course, you can also create your own event listener.
> Something like this:
>
> public class YourClass extends DefaultWorkingMemoryEventListener {
>   public void yourMethodForFiringRules()
>   {
>     // Load the rules file and set the event listener
>     FileReader rulesFile = new FileReader("yourRulesFile.drl");
>     RuleBase ruleBase = RuleBaseLoader.loadFromReader(rulesFile);
>     WorkingMemory workingMemory = ruleBase.newWorkingMemory();
>     workingMemory.addEventListener(this);
>
>     // Assert objects
>     workingMemory.assertObject(new YourObject());
>     ...
>
>     // Fire rules
>     workingMemory.fireAllRules();
>   }
>
>   public void activationFired(ActivationFiredEvent firedEvent)
>   {
>     // Get the name of the fired rule
>     String firedRuleName = firedEvent.getRule().getName();
>     // See API for more methods on ActivationFiredEvent
>   }
> }
>
> God bless,
> Jaime
>
> -----Mensaje original-----
> De: Matthew Pawluk [mailto:[EMAIL PROTECTED]
> Enviado el: miércoles, 08 de febrero de 2006 23:16
> Para: [email protected]
> Asunto: Re: [drools-user] how to know which rule was fired?
>
> Use the WorkingMemory addEventListener method....
>
> snippet:
>
> Rulebase rb = RuleBaseLoader.loadFromInputStream(rulesetStream);
> WorkingMemory wm = rb.newWorkingMemory( ); wm.addEventListener(new
> DebugWorkingMemoryEventListener());
>
>
> Geoffrey Wiseman wrote:
> > I don't know of a detailed example on the site for this; there may be
> one.
> > I've used it before, but I don't have a working example at hand that I
> > can easily supply, and a quick scan of Google doesn't show anything
> obvious.
> >
> > I do agree that this is probably what you want to look into though.
> > Activation fired events will tell you when a rule has been executed,
> > and applying an listener to working memory is fairly painless.
> >
> > On 2/8/06, Peter Van Weert <[EMAIL PROTECTED]> wrote:
> >
> >> I'm sorry, but I can't help you there. I have hardly any practical
> >> experience with Drools myself. Maybe someone else can help?
> >>
> >> Felipe Piccolini wrote:
> >>
> >> Peter,
> >>
> >>   Where can I get more info, doc or some examples for listeners and
> >>   event handlers. I would like to see some code example for a simple
> >>   rule execution, with fact assertions, application data and invoking
> >>   the fireAllRules method.
> >>
> >>   Thanks.
> >>
> >> Wednesday, February 8, 2006, 5:39:25 PM, you wrote:
> >>
> >>    Maybe http://www.drools.org/Event+Model?nocache could be of use to
> >> you (in particular the ActivationFiredEvent-event)?
> >>
> >>     Joel G. Rivera-González wrote:
> >>
> >>  i have a over a meg of rules and we need to know whitch rule was
> fired...
> >>
> >> i know i can send a string with the rule name on the consequence, but
> >> i would like to know if drools provide something for this...
> >> if not...i think it would be a great addition to drools to know the
> rule that was fired...
> >>
> >> thanks...
> >>
> >> -Joel
> >>
> >> Joel G. Rivera-González Wovenware, Inc [EMAIL PROTECTED] "The
> >> first 90% of a project takes 90% of the time, the last 10% takes the
> >> other 90% of the time" - Murphy's Law
> >>
> >>
> >>
> >>
> >>
> >>
> >> --------------------------
> >> Felipe Piccolini
> >> [EMAIL PROTECTED]
> >>
> >>
> >>
> >>
> >>
> >
> >
> > --
> > Geoffrey Wiseman
> >
> >
>
> --
> Matthew Pawluk
> NeuLion Inc.
> 1600 Old Country Road
> Suite 102
> Plainview, NY 11803
> 516.249.6565
> [EMAIL PROTECTED]
>
>
> ______________________
> Este mensaje, y en su caso, cualquier fichero anexo al mismo,  puede
> contener informacion clasificada por su emisor como confidencial  en el
> marco de su Sistema de Gestion de Seguridad de la Informacion siendo para
> uso exclusivo del destinatario, quedando prohibida su divulgacion copia o
> distribucion a terceros sin la autorizacion expresa del remitente. Si Vd. ha
> recibido este mensaje  erroneamente, se ruega lo notifique al remitente y
> proceda a su borrado.
> Gracias por su colaboracion.
> ______________________
> This message including any attachments may contain confidential
> information, according to our Information Security Management System,  and
> intended solely for a specific individual to whom they are addressed.
> Any unauthorised copy, disclosure or distribution of this message  is
> strictly forbidden. If you have received this transmission in error,  please
> notify the sender immediately and delete it.
> ______________________
>
>
>
> ********************************************************************************************************************************
> The information in this email is confidential and may be legally
> privileged. If you have received this email in error or are
> not the intended recipient, please immediately notify the sender and
> delete this message from your computer. Any use, distribution,
> or copying of this email other than by the intended recipient is strictly
> prohibited. All messages sent to and from us may be
> monitored to ensure compliance with internal policies and to protect our
> business.
> Emails are not secure and cannot be guaranteed to be error free as they
> can be intercepted, amended, lost or destroyed,
> or contain viruses. Anyone who communicates with us by email is taken to
> accept these risks.
>
> 收发邮件者请注意:
> 本邮件含保密信息,若误收本邮件,请务必通知发送人并直接删去,不得使用、传播或复制本邮件。
> 进出邮件均受到本公司合规监控。邮件可能发生被截留、被修改、丢失、被破坏或包含计算机病毒等不安全情况。
>
> ********************************************************************************************************************************
>

Reply via email to