[rules-users] Handle activationCancelled Event

Marcus Ilgner marcus.ilgner at gmail.com
Fri Jul 25 09:48:36 EDT 2008


On Fri, Jul 25, 2008 at 3:15 PM, Ingomar Otter <iotter at mac.com> wrote:
> Why don't you use facts for control?
> when mylamp=="on"
> then
> assert/update sth?
>
> That looks easier to me.
>
> --I

Indeed. If I understand your problem correctly, the corresponding rule
should rather look like
rule "Lamp is not on"
when
 $lamp : Lamp(state != "on")
then
// the lamp isn't on anymore - do something
end

Best regards
Marcus

> Am 25.07.2008 um 13:04 schrieb Claudio Rainoldi:
>
>> Hi everyone,
>> i'm developing a java application using drools 4 for domotic control;
>> i ve implemented a listener on my working memory with the method
>> afterActivationFired(...)
>> and activationCancelled(...) .
>> At startup of my app i've write the following lines:
>>
>> listener = *new* FiredRulesListener();
>> workingMemory.addEventListener(listener);
>>
>> Each time a rule is fired the method afterActivationFired(...) is called
>> and
>> it is ok; but when the rule stop to be true the method
>> activationCancelled  isn't
>> never called.
>> I try to be more clear:
>>
>> i 've the following rule:
>> when mylamp=="on"
>> then
>> System.out.println("light 1 on");
>>
>>
>> When i turn on the light 1 the method afterActivationFired(...)  is
>> called,
>> but when i turn off the light the method activationCancelled isn't called.
>> Can someboy help me??
>> Thanks in advance.
>>
>>
>> Cla



More information about the rules-users mailing list