[rules-users] How to remove Drools 5 facts from a web service

Matthew Erler wires8 at yahoo.com
Tue Aug 2 09:36:46 EDT 2011


That worked.  Thank you very much.

--- On Tue, 8/2/11, Wolfgang Laun <wolfgang.laun at gmail.com> wrote:

From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] How to remove Drools 5 facts from a web service
To: "Rules Users List" <rules-users at lists.jboss.org>
Date: Tuesday, August 2, 2011, 1:35 AM

2011/8/1 Matthew Erler <wires8 at yahoo.com>


The first thing that the service method needs to do is clear out all the facts inserted during the last service method invocation.  I use StatefulKnowledgeSession.insert(Object fact) to add facts and StatefulKnowledgeSession.getAgenda().clear() to clear out all facts. 

The Agenda is where all rule activations live. Facts are reachable via the kSession object, e.g., kSession.getFactHandles(), and you could use retract() on them. But note well that retracting facts is not a free lunch: each one updates the Rete network. 


Calling kSession.dispose() and kBase.newStatefuleKnowledgeSession() is a perfectly reasonable way to clear the ring for the next round. 

-W


-----Inline Attachment Follows-----

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110802/1126cb91/attachment.html 


More information about the rules-users mailing list