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

Wolfgang Laun wolfgang.laun at gmail.com
Tue Aug 2 01:35:23 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110802/9d9bdd32/attachment.html 


More information about the rules-users mailing list