[rules-users] Disable rules at runtime to make sure they get executed only once

Pavel Tavoda pavel.tavoda at gmail.com
Sat Feb 20 02:44:38 EST 2010


Of course it doesn't matter which object you use. Use something
natural to your project. Mechanism is same.

Pavel


On Sat, Feb 20, 2010 at 7:58 AM, Malinda Kaushalye <kaushalye at yahoo.com> wrote:
> Many thank Pavel.
> But I dont think I followed RuleXor in your reply. But I tried to insert an event with a key value in the RHS.
> The same value I used in LHS with other business logic to avoid repeated execution.
> e.g.
> when
> not EventR(Id="KEY")
> //Other logic
> then
>      //Other executions
>      insert(new EventR("KEY");
>
> If I get your answer correct, this is similar to what you suggest.
> However, that solution seems bit ugly. It makes the other business logic very difficult to read. That's why I wanted to find a proper way to do that, uding drools API.
> Cheers,
> Malinda
>
>
>
> ----- Original Message ----
> From: Pavel Tavoda <pavel.tavoda at gmail.com>
> To: Rules Users List <rules-users at lists.jboss.org>
> Sent: Sat, 20 February, 2010 12:18:33 AM
> Subject: Re: [rules-users] Disable rules at runtime to make sure they get executed only once
>
> Maybe here is some complex support for this but if you use ruleflows
> than it's complicated however what about (noob idea):
>
> rule "first - only once"
> when
>     not RuleXor( name == "first")
>     ...
> than
>     ....
>     insert (new RuleXor("first"));
> end
>
> On Fri, Feb 19, 2010 at 2:01 PM, Malinda Kaushalye <kaushalye at yahoo.com> wrote:
>> Hi All,
>> I need to write a set of rules that each get executed only ONCE. However, the conditions are met at different stage of execution as events are coming thru a stream. Therefore I need to disable each rule at different stages.
>> I was looking for some mechanism to disable a rule after it gets executed. Something like this.
>>
>> rule "myExecuteOnlyOnceRule"
>>  when
>>   //some condition tat evaluate events
>>  then
>>    this.rule.disable() / disable(drools.getRule())
>> end
>>
>>
>> Let me know if you know such a function or a workaround for this issue.
>> Cheers,
>> Malinda
>>
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
>
> _______________________________________________
> 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