[rules-users] Insert and Retract from drools server in one call?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jan 17 07:28:39 EST 2012


On 17/01/2012, dunnlow <dunnlow at yahoo.com> wrote:
> Sorry for my terminology; I'm a noob, but I think I understand your
> suggestion.  By "initial" facts, I just mean the facts that I insert within
> my batchexecution command.  In reality, I am adding a pojo to that
> batchexecutioncommand and then my rules check the pojo's attributes.  I
> don't want that pojo to remain in memory; however, there are new facts that
> are created (RHS) by the rules that are fired and I want those to remain in
> working memory.

This is quite clear now.

>
> If I understand your response, you are suggesting one approach is to add a
> rule with a really low salience that will trigger whenever it sees the bean
> and retract it after the other rules have fired.  Something like:
>
> rule retractInitialFact
>   salience -100
> when
>   $mp:MyPojoBean
> then
>   retract($mp)
>
> Is that correct?

Yes, that's what I meant.

>  I have been trying to avoid using salience (I feel like I
> read that somewhere).

IMHO, such a "background" or "cleanup" rule is not a violation of the
general principle "Do not use salience to achieve a particular order
of rule firings."

-W

>  However, is that the most common way to do what I am
> trying to do?  There is no way in the batch execution command to add a
> "retract" as the last command?
>
> Thanks again.
> -J
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Insert-and-Retract-from-drools-server-in-one-call-tp3657736p3665856.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list